如果时间保持长的话可以用cookie,用session的时候,要设置持续时间,
具体修改方法如下,在web.config中进行如下配置
<system.web>
<sessionState mode="InProc" timeout="30"/>//修改timeout时间
</system.web>
具体修改方法如下,在web.config中进行如下配置
<system.web>
<sessionState mode="InProc" timeout="30"/>//修改timeout时间
</system.web>
cookieless="true|false"
timeout="number of minutes"
stateConnectionString="tcpip=server:port"
sqlConnectionString="sql connection string"
stateNetworkTimeout="number of seconds"
/>
必须有的属性是属性 选项 描述
mode 设置将Session信息存储到哪里
Off 设置为不使用Session功能
InProc 设置为将Session存储在进程内,就是ASP中的存储方式,这是默认值。
StateServer 设置为将Session存储在独立的状态服务中。
SQLServer 设置将Session存储在SQL Server中。
我用的是 <sessionState mode="StateServer" /> 资料上说是可以保存在独立进程中,比较稳定如果用的是Cookie的话,如果用户关闭浏览器的Cookie,会不会出问题呢?
==
从ASP.NET 1.1 Session就支持无Cookie的回话,此时Sessonid保存在用户的url地址栏里
这是我用的Web.config部分 <sessionState mode="StateServer" />
<authentication mode="Window" />但有部分计算机登录时出现问题。
cookieless="true ¦false"
timeout="number of minutes"
stateConnectionString="tcpip=server:port"
sqlConnectionString="sql connection string"
stateNetworkTimeout="number of seconds"
/>
必须有的属性是 属性 选项 描述
mode 设置将Session信息存储到哪里
Off 设置为不使用Session功能
InProc 设置为将Session存储在进程内,就是ASP中的存储方式,这是默认值。
StateServer 设置为将Session存储在独立的状态服务中。
SQLServer 设置将Session存储在SQL Server中。
这个楼上发过了
(2)SQL Server麻烦一些,但保证一定都可以。