1

I have a provider hosted (MVC/C#/CSOM) addin. In this addin I have a homecontroller with an index-page. The page(Page A) has links to another page on the same web application (VS project) ("Page B").

These links includes the querystring parameters (SPHostUrl, SPProductNumber, SPAppWebUrl, SPLanguage, SPClientTag) that I got from the original request (home controller).

BUT: When I get to the controller of "Page B" and try to re-create the context is null.

var thisWillBeNull = CurrentSharePointProvider.Current.GetSharePointContext()

Which is fine I guess, but When I dig deeper the code of SharePointContext.cs It tries to create a new context in

TokenHelper.GetContextTokenFromRequest()

, it looks for either a qstring parameter or a form parameter named (in my case) "SPAppToken". which does not exist. I see that it does exist as a form parameter in the original request (to "Page A")

So what Im actually asking is, should a simple html-link be so cumbersome? Am I missing something? Ive seen samples where they store the context in session, but I try to avoid this. Does anyone know how you are supposed to handle context in regards to jumping between pages?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.