1) I have created a provider hosted app on premise and able to execute the default code that Visual studio creates in the new default page without any issues. The code is to read the host web title. Now I wrote the below to see the context token.
string contextToken = TokenHelper.GetContextTokenFromRequest(Page.Request);
However the context token returned is NULL. Still the code can create context for host web and read the title. So in which case does the app get a context token and then ask for the access token ?
I am directly running the app using "Start" in visual studio.
2) When I run the app from visual studio it works however when I click on the app from the SharePoint site, it gives a page cannot be displayed error. The URLs it is redirected to are exactly the same !