I am still experimenting this approach. But I have a few questions:
1. In the database aspnetState, there are two tables: aspStateTempapplications and aspstateTempSessions. What are the purposes of these two tables?
2. Now everytime a user log on to my site, I created a session variable called ClientID. Where is this session variable stored? The reason I went for SQL server to store session variable is because I do not want use the server memory. But I could not find
session variable ClientID in the two tables mentioned above.
3. Related to question 2, I created quite a few session variables in my web application. After using them, I normally clean them up by using session.remove("VariableName"). Does this still work in SQLServer mode?
The ASPStateTempApplications table have the mapping of self-made application id and the information of web virtual directory. The ASPStateTempSessions table is to store the session data. The key field of ASPStateTempSessions table is SessionId and it is
a 32 bytes string. If you use Session.Remove() method the session will be removed from the session-state collection. When you store the data in session with SQL Server session state mode the data will be encrypted.
Richey, thanks a lot for the reply. I have been waiting for some thoughts from others on this forum. Your answer cleared a lot of my doubt and assumption. So please let me clarify if i understand what you said correctly.
Richey
When you store the data in session with SQL Server session state mode the data will be encrypted.
Based on the above quote, it means, for example, I created Session("ClientID"), so the value of the session is ecrypted in the AspStateTempSession table, is it correct? Is it encrypted in the SessionItemShort column?
The reason that I tried to understand this is because I have read a post by one member (http://forums.asp.net/t/1794432.aspx/2/10?Need+your+advice+on+passing+values+between+pages+)
saying that storing the session variable in SQL server will preserve the value even after session time out. But it doesn't preserve it in my case. After the time out, that expired session row is deleted from the table.
Is there a way I can preserve the session variables that I want to keep after session time out?
asplearning
Participant
909 Points
952 Posts
Need your advice on storing session variable in SQLServer
May 03, 2012 05:23 AM|LINK
Hello everyone, I have just created a database to store session using this link:
http://blogs.msdn.com/b/akshayns/archive/2008/10/04/how-to-configure-sql-server-to-store-a-session-state.aspx
I am still experimenting this approach. But I have a few questions:
1. In the database aspnetState, there are two tables: aspStateTempapplications and aspstateTempSessions. What are the purposes of these two tables?
2. Now everytime a user log on to my site, I created a session variable called ClientID. Where is this session variable stored? The reason I went for SQL server to store session variable is because I do not want use the server memory. But I could not find session variable ClientID in the two tables mentioned above.
3. Related to question 2, I created quite a few session variables in my web application. After using them, I normally clean them up by using session.remove("VariableName"). Does this still work in SQLServer mode?
4. Finally, I saw this quote:
SQLServer Mode Allows to store only serializable types (http://www.codeproject.com/Articles/31994/Beginners-Introduction-to-State-Management-Techniq#application_state)
What does it mean in simple words?
Thank you very much.
Regards;
asplearning
Participant
909 Points
952 Posts
Re: Need your advice on storing session variable in SQLServer
May 03, 2012 08:08 AM|LINK
Anybody please?
asplearning
Participant
909 Points
952 Posts
Re: Need your advice on storing session variable in SQLServer
May 03, 2012 10:14 PM|LINK
I am sorry. But anybody could share some thoughts on this please? Please tell me if I posted in the wrong forum.
Thanks in advanced.
Richey
Contributor
3816 Points
431 Posts
Re: Need your advice on storing session variable in SQLServer
May 07, 2012 10:13 AM|LINK
Hi,
The ASPStateTempApplications table have the mapping of self-made application id and the information of web virtual directory. The ASPStateTempSessions table is to store the session data. The key field of ASPStateTempSessions table is SessionId and it is a 32 bytes string. If you use Session.Remove() method the session will be removed from the session-state collection. When you store the data in session with SQL Server session state mode the data will be encrypted.
asplearning
Participant
909 Points
952 Posts
Re: Need your advice on storing session variable in SQLServer
May 07, 2012 11:01 PM|LINK
Richey, thanks a lot for the reply. I have been waiting for some thoughts from others on this forum. Your answer cleared a lot of my doubt and assumption. So please let me clarify if i understand what you said correctly.
Based on the above quote, it means, for example, I created Session("ClientID"), so the value of the session is ecrypted in the AspStateTempSession table, is it correct? Is it encrypted in the SessionItemShort column?
The reason that I tried to understand this is because I have read a post by one member (http://forums.asp.net/t/1794432.aspx/2/10?Need+your+advice+on+passing+values+between+pages+) saying that storing the session variable in SQL server will preserve the value even after session time out. But it doesn't preserve it in my case. After the time out, that expired session row is deleted from the table.
Is there a way I can preserve the session variables that I want to keep after session time out?
Thanks.