会话值未持久存储在Azure App Service中 [英] Session Value not persisted in Azure App Service
问题描述
会话未在Azure App Service中保留
Session not persisted in Azure App Service
我在Asp.net MVC中有一个Web应用程序,我用来设置会话.当我单击LoginButton
I have a Web Application in Asp.net MVC, I used to set the session. When I click a LoginButton
Session["FlowType"] : "Auth"
现在,请求将转到IdentityServer并在回叫期间我试图检索会话 Session ["FlowType"]
,它给了我 null
值.
Now the request goes to IdentityServer and during Callback on
I tried to retrieve the session Session["FlowType"]
and it gave me null
value.
我也检查了 Azure Affinity Cooki e.一样,当我签到提琴手时.
I checked the Azure Affinity Cookie too. It is same, when I checked in fiddler.
有人可以帮我吗?
推荐答案
首先,确保字符串与"FlowType"相同.
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();
检查'test'的值,为null或'aaa'.如果test的值正确,则可以打印Ctrl + Alt + i在Visual Studio中打开立即窗口".然后,您可以检查缺少Session的时间.
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.
最后一步,也许您可以修改web.config来设置有关Session的配置.希望以上回答对您有所帮助.
The last Step,maybe you can modfiy your web.config to set config about the Session. I hope the above answers can help you.
添加图片
如何在天蓝色中调试.您也可以在Google上搜索它.
How to debug in azure. You also can google it.
步骤1:确保发布配置设置.像波纹管一样
step 1: Make sure publish configuration setting. Like pic bellow
第2步:发布成功后,您可以附加调试器
step 2: When publish succeed,you can attach debugger
- 我的IDE是vs2019,您可以单击View-> Cloud Explore,然后找到您的源组和Web应用程序.
- 就像图片一样,您找到它,然后单击,它将显示Attach Debugger,然后您调试器正在测试中.
3.第一次调试将花费很长时间.
3. The first debugging will take a long time.
这篇关于会话值未持久存储在Azure App Service中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!