Technical Training
ASP.NET TrainingTable of Contents
Managing State with ASP.NET and C#
Managing State with ASP.NET and C# - Page 2
Managing State with ASP.NET and C# - Page 3Managing State with ASP.NET and C# Page - 2
Managing State with ASP.NET and C#
Configuring Session State
You can configure the session state in your web.config file. This means that the settings that you will do in the web.config file will be affected to the whole application. Let's see how we can do this:
Configuring In-Process Mode
In-process is the default session state mode. To use in-process mode, set the mode attribute of the
The following shows a sample configuration setting for in-process mode.
timeout="20"/>
(msdn)
Configuring State Server Mode
To use State Server, you must first make sure ASP.NET state service is running on the remote server used for the session store. This service is installed with ASP.NET and Visual Studio .NET at the following location:
systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe
Next, set the mode attribute of the
The following shows a sample configuration setting for State Server mode.
cookieless="false"
timeout="20"/>
(msdn)
Configuring SQL Server Mode
To use SQL Server, first run either InstallSqlState.sql or InstallPersistSqlState.sql on the computer with SQL Server that will store the session state. Both scripts create a database called ASPState that includes several stored procedures. The difference between the scripts is where the ASPStateTempApplications and ASPStateTempSessions tables are placed. The InstallSqlState.sql script adds these tables to the TempDB database, which loses session data if the computer is restarted. The InstallPersistSqlState.sql script, on the other hand, adds these tables to the ASPState database, which allows session data to be retained when the computer is restarted.
Both of these script files are installed by default at the following location:
systemroot\Microsoft.NET\Framework\versionNumber
Next, set the mode attribute of the
The following shows a sample configuration setting for SQL Server mode.
cookieless="false"
timeout="20"/>
In SQL Server mode, session state can also be configured to work in a failover cluster. A failover cluster is two or more identical, redundant Web servers that store their session data on a separate computer in a SQL Server database. If a Web server fails, another server in the cluster can take over and serve requests without session data loss. To configure a failover cluster, set the
(msdn)
ASP.NET Training
- ASP.NET with C# Training Launch
- ASP.NET with C# Training Course Outline
- Introduction to ASP.NET with C#
- ASP.NET Web Forms Controls
- ASP .NET: Validating User Input with C#
- Using Rich Server Controls with C#
- Accessing Data with C#
- ASP.NET Using the DataList and Repeater, Datagrid Controls
- Managing Data with ADO.NET DataSets and C#
- Creating and consuming XML Web Services with C#
- ASP .NET Migration and Interoperability
- Managing State with ASP.NET and C#
- Caching in ASP.NET
- Configuring and Deploying ASP.NET Applications
- Securing ASP.NET Applications with C#







