有三种处理模型:
1-默认是InProc
<sessionState ... mode="InProc" />
2-StateServer
Start Aspnet_state.exe. You can start it manually (from the command line) by executing the following command:
net start aspnet_state
<configuration> <system.web> <sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" /> </system.web> </configuration><configuration> <system.web> <sessionState mode="StateServer" stateConnectionString="tcpip=192.168.1.2:42424" /> </system.web> </configuration>
Add the desired port number to the registry at HKEY_LOCAL_ MACHINE/System/CurrentControlSet/Services/aspnet_state/ Parameters/Port.
Replace 42424 with the new port number in stateConnectionString.
3-sql Server Session StateCreate the database that holds the session state. The .NET Framework SDK provides a script that creates the database for you; it’s called InstallsqlState.sql. To run it,open a command prompt window and type the following command:
This command creates a sql Server database named ASPState on the host machine and adds to it all the tables,stored procedures,and other infrastructure that ASP.NET uses to access the database,as shown in figure 9-11.
Add a mode=“sqlServer” attribute and a sqlConnectionString attribute to the sessionState element in Machine.config or a local Web.config file. The latter of these two attributes provides the @R_308_4045@ion ASP.NET needs to connect to the database
<configuration> <system.web> <sessionState mode="sqlServer" sqlConnectionString="server=localhost;uid=sa;pwd=" /> </system.web> </configuration>
后两种会话状态需要对象的串行化.利用..net平台强大的串行化机制.
<sessionState timeout="60" />
Session.Abandon ();
<%@ Page EnableSessionState="false" %>
<sessionState mode="Off" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。