Tutorials
ASP.NET
Managing State with ASP.NET and C#
Managing State with ASP.NET and C# - Page 2
Managing State with ASP.NET and C# - Page 3
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:
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)
Next Page: Managing State with ASP.NET and C# - Page 3
| This site is fantastic for beginners and is very helpful |
| How I can use session for Login page in asp.net and how I can sign out through session. Please help me. |
| How I can use Session for LogIn page in asp.net. |