Click here to Skip to main content
Rate this: bad
good
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.
 
Web.Config:
<system.web>
        <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>
 </system.web>
 
Error:
 
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 5:36am
Edited 9-Jan-13 5:46am
v2
Comments
ryanb31 at 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
good
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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 395
1 Abhinav S 235
2 Nirav Prabtani 187
3 _Amy 160
4 Dave Kreskowiak 155
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,597
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2014
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