Last post Apr 17, 2011 09:55 AM by famas
Apr 16, 2011 10:16 AM|famas|LINK
I am writing after two days of continuous effort to setup session state mode to hold my session variables. I tried Inproc mode but it failed to keep to the data after the page is redirected to OpenID server. Then I came to know that I must use SQL server
mode. But bad news is that I am getting error connection to the SQL server.
I have set password for 'sa' login (is it ok or it must be blank password?) Why it says 'ASPState' database in the above error since the database name for storing sessions (that i can see in SQL server management studio) is 'aspnetdb'. This is so confusing.
Do I have to use someother login instead of 'sa'. I think I am doing something wrong in the web.config file.
My web.config file : (I added the session state parameter myself in the file. In order to set the mode to SQLserver. Please note that I tried to use Serverstate mode before using SQLserver mode. Maybe the two modes are getting mixed now. just a thought..)
Is there any step by step guide to do all this easy but so much confusing stuff. I am stuck for 2 whole days. Read the other posts but could not find the right one working for me. I guess I have to look for alternatives if session management is such a hard
thing to do in ASP.NET...
Thanks alot if someone is here with me till now))) Looking for a miracle!!!
Apr 16, 2011 02:25 PM|V.Karthikeyan|LINK
Looks like you havent added the ASPState database. You need to install separate DB "ASPState" for OutProc state management. ASPNetDB is for only Membership & Roles, And personalization stuffs..
You can install ASPNet db with the following commandline params..
aspnet_regsql.exe -ssadd -sstype:p -S [myserver] -U [mylogin] -P [mypassword]
The parameters are case sensitive. This will create the ASPState database on the specified server. You could use the parameter -E instead of the -U and -P parameters to use the current credentials. For more info on ASPNET_RegSQL. check this out..
And here you can find a simple article on setup session state on sql server.
Hope it helps!
Apr 17, 2011 09:55 AM|famas|LINK
Thank you so much for your helpful reply. i have sucessfully connected with the ASPState db now. sessions are also getting saved. I just have one question now. httpcontext.Session["key"] can only be used in the controller section? i am trying to access the
session variable using this statement from an openid class (not controller) but it is only allowing me to use httpconext.current.session["key"] and not httpcontext.session["key"].
It would be great if i get some idea about whats going on here.. thanks again for your great help!!
I am marking your post as answer))