1、改成使用cookie

2、把<sessionState    mode设置成StateServer就ok了,我也不知道什么原因。 

 1Session丢失的几种解决方法<!--  会话状态设置
 2Session丢失的几种解决方法          默认情况下,ASP.NET 使用 Cookie 来标识哪些请求属于特定的会话。
 3Session丢失的几种解决方法          如果 Cookie 不可用,则可以通过将会话标识符添加到 URL 来跟踪会话。
 4Session丢失的几种解决方法         若要禁用 Cookie,请设置 sessionState cookieless="true"。
 5Session丢失的几种解决方法    -->
 6Session丢失的几种解决方法    <sessionState 
 7Session丢失的几种解决方法            mode="StateServer"
 8Session丢失的几种解决方法            stateConnectionString="tcpip=127.0.0.1:42424"
 9Session丢失的几种解决方法            sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
10Session丢失的几种解决方法            cookieless="false" 
11Session丢失的几种解决方法            timeout="40" 
12Session丢失的几种解决方法    />

3、使用SqlServer保存Session

4、让杀毒软件不扫描bin文件夹下的文件和Web.Config文件 。

5、定时刷新页面,不让Session丢失。

相关文章: