Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

SharePoint Provider Hosted App Giving Object reference error at GetRealmFromTargetUrl function in Token Helper

$
0
0

Below is the error:

Server Error in '/SharePointApp1' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[NullReferenceException: Object reference not set to an instance of an object.]
   SharePointApp1Web.TokenHelper.GetRealmFromTargetUrl(Uri targetApplicationUri) in c:\Users\***\Documents\Visual Studio 2012\Projects\SharePointApp1\SharePointApp1Web\TokenHelper.cs:580
   SharePointApp1Web.TokenHelper.GetS2SClientContextWithWindowsIdentity(Uri targetApplicationUri, WindowsIdentity identity) in c:\Users\***\Documents\Visual Studio 2012\Projects\SharePointApp1\SharePointApp1Web\TokenHelper.cs:553
   SharePointApp1Web.Pages.Default.Page_Load(Object sender, EventArgs e) in c:\Users\***\Documents\Visual Studio 2012\Projects\SharePointApp1\SharePointApp1Web\Pages\Default.aspx.cs:25
   System.Web.UI.Control.LoadRecursive() +70
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3177

When I enabled the trace logs I realized the request type is "GET" instead of "POST" and in the header collection I am not getting the Authentication Header. After analysing further I understood the above error is because realm returned is NULL from SharePoint to remote server.

We do not have windows authentication enabled on the remote server. Also the remote server is in a separate LAN than the SharePoint Farm servers. 

Please suggest the possible reasons for the above error. I am stuck in this issue for almost 2 weeks now.



Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>