Greetings. I'm developing a provider-hosted 2013 app for Office 365. I can successfully build and deploy the app to my developer site. The code I'm using is a sample app from MSDN (http://msdn.microsoft.com/en-us/library/fp142381.aspx). My problem is that the code that runs in Page_Load works, but if I bind any code to a control (i.e. a button) in an event handler, the ContextToken is always null. The following code, inside an event handler (after post back), always results in null context token but works in the Page_Load:
var contextToken = TokenHelper.GetContextTokenFromRequest(Page.Request); if(contextToken == null) lblMessage.Text = "context token is null";