OutProc Session SQLServer

From JholJhapata
Revision as of 15:29, 29 July 2022 by Admin (talk | contribs) (Created page with "ASP.NET session state is designed to enable you to easily store user session data in different sources for your ASP.NET applications. By default, session state values and info...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ASP.NET session state is designed to enable you to easily store user session data in different sources for your ASP.NET applications. By default, session state values and information are stored in memory within the ASP.NET process. Alternatively, you can store session data in a SQL Server database, where it can be shared by multiple Web servers. For more information about session state, see Implementing a Session-State Store Provider and Session-State Modes.

Configure SQL Server to store ASP.NET session state

Before you can actually store a session state in SQL server, you need to configure it. This configuration is done via a command line tool called ASPNET_REGSQL.EXE. You can store the session state in three possible locations within the SQL Server:

Command Description
-S <server> Species the IP address or the name of SQL server in which you want to store the session state
-U Specifies the user ID to be used when connecting to the SQL Server
-P Specifies the password to be used when connecting to the SQL Server
-E Indicates that you want to use integrated security when connecting to the SQL Server
-ssadd Adds support for the SQLServer mode session state
-ssremove Removes support for the SQLServer mode session state
-sstype Type of session state support. This option can be:

t for temporary storage
p for persistent storage
c for custom storage

-d
<database>
The name of the custom database to use if -sstype switch is "c"

It opens command prompt. Type the following command to create the SQL State Database tables and procedures.

C:\%windir%\Microsoft.NET\Framework\<versionNumber>\

For creating default Database for SQL State.

aspnet_regsql.exe -S XXXXX -U XX -P XXXXXXXXX -ssadd -sstype p

Update <sessionState> tag in web.congif

 <system.web>
 <sessionState mode="SQLServer" sqlConnectionString="data source=DESKTOP-ABGPQE5; user id=sa;password=9fc300a7;" cookieless="false" timeout="20"/>    
 </system.web>