Click here to Skip to main content
12,821,315 members (36,709 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
How to configure session state for 'SqlServer' Mode in Web.config

I tried the following but iam getting error please help me on this, Thanks in advance.

        <compilation debug="true" targetFramework="4.0" />
      <sessionState cookieless="false" mode="SQLServer"  sqlConnectionString="Data Source =localhost;Initial Catalog =sample;User ID = VIGNESHJ\Admin;password=viki;Integrated Security=true;"></sessionState>


Server Error in '/' Application.

Configuration Error

Source Error:

Line 9:      <system.web>
Line 10:         <compilation debug="true" targetFramework="4.0" />
Line 11:       <sessionState cookieless="false" mode="SQLServer"  sqlConnectionString="Data Source =localhost;Initial Catalog =sample;User ID = VIGNESHJ\Admin;password=Viki;Integrated Security=true;"></sessionState>
Line 12:     </system.web>
Line 13:
Posted 9-Jan-13 6:36am
Updated 9-Jan-13 6:46am
ryanb31 9-Jan-13 14:34pm
Did you run the SQL script to create the necessary tables? Also, is there more to the error?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You will need "allowCustomSqlDatabase" property to be set to "true" when specifying a custom database in your "sqlConnectionString" attribute for SessionState. Or you can remove the "initial catalog" specification from your connection string so that "ASPState" default database is used for session management.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170308.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100