How to enable ASP.NET SQL Server Session on your web application

 DETAILS

 

In ASP.NET, there are 3 different modes for storing session information.
  • InProc
  • StateServer
  • SQLServer

     

    At OISSite.com, we support both InProc and SQLServer session. By default, ASP.NET session is stored in-process (InProc).

     

    There are pros and cons for these modes.

     

    InProc mode offers the fastest performance because session is stored in the IIS Worker Process. The downside of InProc session is that sessions can be lost if the worker process is recycled for whatever reason.

     

    SQL Server session on the other hands is slower than InProc, about 15-20% slower, but the session information remains persistent even after the worker process is recycled.

     

    You should choose an appropriate state management mode depending on your application. For example, if losing session is not acceptable, you should consider using SQL Session rather than InProc.

     

    To enable SQL Server Session, follow the steps below:
  • While not required, we recommend purchasing a new MS SQL database in the MS SQL manager to avoid potential conflicts
  • Create a support ticket to request for an installation. Include the Database name and database user.
  • You will receive an email as soon as the Session State database schema is created
  • Update your web.config file as follows

     

     < sessionState mode="SQLServer" allowCustomSqlDatabase = "true" sqlConnectionString="data Source=<SQLSERVERNAME>;database=<SQLDATABASENAME>;user id=<SQLUSER>;password=<SQLPASSWORD>" cookieless="false" timeout="15" /> 

     

  • Session information should be stored in your SQL database now

     

    • 0 Els usuaris han Trobat Això Útil
    Ha estat útil la resposta?

    Articles Relacionats

    After I configure the custom error setting in the control panel, I still get the generic error page?

    DETAILS Custom error setting is a web server setting which affects all file types (.htm, .gif,...

    How do I connect my ASP.net application to MySQL database?

    DETAILSIn general, 2 different methods can be used to connect an ASP.net application to MySQL...

    How do I get my ASP.net application to display non-English language?

    DETAILSASP.net allows the developer to encode the page using character sets other than...

    How do I get my ASP.net application to display non-English language?

    DETAILSASP.net allows the developer to encode the page using character sets other than...

    How do I setup custom error for my ASP.net application?

    DETAILS ASP.net has its own built-in error handling.  To set up custom error handling for...