Saving Session Data in SQL Server

Hai All, Here I am going to give an idea to implement the session storing in SQL Server in the Database, For that First we need the SQL Database with relevant tables, For that we can use the following Commands

cd /d "C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319"

                                                    OR

cd /d "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"

 

the above statement is used to get the Directory where the framework od .NET is installed in your pc,the version number at the end may change according to your version, then use the following commands

 


aspnet_regsql -S .\SQLExpress -E -ssadd -sstype p


aspnet_regiis.exe /iru

 

It will Create the “ASPState” database in your SQLServer

Then use the Following in <system.web> in your web.config file

<sessionState mode="SQLServer" timeout="60" sqlConnectionString="yourConnectionString;" cookieless="false" />

 

Then The sessions will be stored in the SQLServer

Thank you

SHARE

Gibin Francis

Hi. I’m Software Engineer in India. I’m Web Developer, Creative Coder, Web Designer, logo Designer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Designer. Inspired to make things looks better and Do the this in the best way.

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment