Do this |
Example | |
---|---|---|
Store information in the Application collection |
Use either the Application object or the Application. Contents collection to add the item to the collection, or use the Application.Add method. |
Application[key] = value; |
Modify information in the Application StaticObjects collection |
Add an <Object> tag in Global.asax with the runat="server" attribute and the scope= "application" attribute. |
<object runat="server" id="myObject" scope="Application" class="myClassName"> </object> |
Store session state in a dedicated server process |
Modify the sessionState configuration section of your application’s Web.config file, changing the mode attribute to StateServer and the stateConnectionString attribute to the appropriate IP address and TCP port for the state server being used. |
<sessionState mode="StateServer"stateConnectionString= "tcpip=127.0.0.1:42424"/> |
Store session state in a SQL Server database |
Modify the sessionState configuration section of your application’s Web.config file, changing the mode attribute to SQLServer and the sqlConnectionString attribute to the appropriate data source name, user ID, and password for the SQL Server being used. |
<sessionState mode="SQLServer"sqlConnectionString= "data source=127.0.0.1;user id=sa;password="/> |
Provide support for session state without cookies |
Modify the sessionState configuration section of your application’s Web.config file, changing the cookieless attribute to true. |
<sessionState cookieless="true"/> |