0
votes

Session not persisted in Azure App Service

I have a Web Application in Asp.net MVC, I used to set the session. When I click a LoginButton

Session["FlowType"] : "Auth"

Now the request goes to IdentityServer and during Callback on I tried to retrieve the session Session["FlowType"] and it gave me null value.

I checked the Azure Affinity Cookie too. It is same, when I checked in fiddler.

Can someone help me with this.

1

1 Answers

1
votes

First, make sure the strings is same like 'FlowType'.

Second,you can try to debug your code like below.

Session["FlowType"]="aaa";
string test = Session["FlowType"].ToString();

Check the value of 'test', is null or 'aaa'. If the value of test is correct,maybe you can print Ctrl+Alt+i to open the Immediate Window in Visual Studio. Then you can check when the Session is missing.

The last Step,maybe you can modfiy your web.config to set config about the Session. I hope the above answers can help you.

Add Pic Debug in azure

How to debug in azure. You also can google it.

step 1: Make sure publish configuration setting. Like pic bellow

publish configuration

step 2: When publish succeed,you can attach debugger

  1. My IDE is vs2019, you can click View-> Cloud Explore ,then you find you sourcegroup and web app.
  2. Like pic, you find it , and click, it will show Attach Debugger, then you debugger in azure to test.

How to find you attach app 3. The first debugging will take a long time.