如果web.config更改,会话将为空 [英] session becomes null if web.config changes

查看:101
本文介绍了如果web.config更改,会话将为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想加密和解密web.config中的连接字符串.它工作正常.
我曾经使用过DataProtectionConfigurationProvider:method.

我的问题是,如果我加密,它将动态更改我的web.config文件.但是我的会话将变为null.WHY

mypage中的会话即将到来,但同一会话对象无法在另一个页面中使用,即,如果我们使用reponse.redirect(defalut2.aspx),它将不在default2页面中出现


谢谢
Srinivas

Hi,

I want to encrypt and decrypt the connectionstring in web.config .it is working fine.
i had used DataProtectionConfigurationProvider:method.

my problem is if i encrypt then it will dynamically change my web.config file.but my session is becoming null .WHY

session in mypage is coming but the same session object cant be available in another page i.e if we use reponse.redirect(defalut2.aspx) it is not coming in default2 page


Thanks
Srinivas

推荐答案

如果更改web.config,则IIS将重新加载文件,并且应用程序池将重置会话所在的应用程序池.您需要使用ASP.Net会话状态或将会话放入SQL.这很容易做到.请参见此处. [
If you change web.config IIS reloads the file and the app pool it is in which resets the Session. You need to use either the ASP.Net Session State or put your Session into SQL. It is easy to do. See here.[^]


这篇关于如果web.config更改,会话将为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆