2 February 2014

Sql Server Mode

      In this mode stores session state in a SQL Server database. Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

       Objects stored in session state must be serializable if the mode is SQL Server
       To use SQLServer mode, you must first be sure the ASP.NET session state database is installed on SQL Server. You can install the ASP.NET session state database using the Aspnet_regsql.exe tool

         To configure an ASP.NET application to use SQLServer mode, do the following in the application's Web.config file:


·         Set the mode attribute of the session State element to SQLServer.
·         Set the sqlConnectionString attribute to a connection string for your SQL Server database.
Implementation of SQL Server :

   <configuration>
      <system.web>
      <sessionState mode="SQLServer"
      SqlConnectionString="Integrated Security=SSPI;
      data source=SampleSqlServer;" />
    </system.web>
  </configuration>

Configuring Sql server in web farm

        To configure SQLServer mode for a Web farm, in the configuration file for each Web server, set the session State element's sqlConnectionString attribute to point to the same SQL Server database. The path for the ASP.NET application in the IIS metabase must be identical on all Web servers that share session state in the SQL Server database




No comments:

Post a Comment