But to make the above to work, we need to setup the sql server which is mentioned in connection string above. To do this, I did the following steps mentioned in some article found in Google search.
- Find the file 'aspnet_regsql.exe' in the location 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727'.
- Run the aspnet_regsql.exe.
- Follow the wizard with all default values till the wizard finishes.
- Verify that a new database is created in the sql server.
This time I got a different exception.
"Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL server. Please install ASP.NET Session State SQL Server version 2.0 or above."
To solve these problems I did a long research and found a way.
- Open command prompt
- Change the current directory to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727'.
- Run aspnet_regsql.exe -S SqlServer -E -ssadd -sstype p
- You will notice the database 'ASPState' created in the sql server give
- That's it. Your application is ready to use the sql server to store the session state.