Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > session expiry when using sessionState mode="SQLServer"

Reply
Thread Tools

session expiry when using sessionState mode="SQLServer"

 
 
Moe Sisko
Guest
Posts: n/a
 
      04-28-2008
Using dotnet 2.0 sp1,

I've got ASP.NET session state working ok in SQLServer mode, but the
sessions never seem to expire.

e.g if I add a timeout attribute like so :

<sessionState mode="SQLServer"
sqlConnectionString="Integrated Security=SSPI;data source=localhost"
timeout="1" >

the session doesn't seem to timeout. The timeout works fine in inProc
session mode.

Any ideas ?
TIA


 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-28-2008
re:
!> the session doesn't seem to timeout.
!> The timeout works fine in inProc session mode.

Session_End doesn't fire in SQL Server session state mode.

Unless you're running a multiple web server scenario ( web farm ),
when you need to keep track of user sessions in several servers,
don't use SQL Server *or* State Server to track session state
unless you're willing/able to take a performance hit.

The cost of serialization/deserialization affects performance.

In the case of State Server, the cost is about a 15% performance degradation.
In the case of SQL Server, the cost is about a 25% performance degradation.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
"Moe Sisko" <null> wrote in message news:(E-Mail Removed)...
> Using dotnet 2.0 sp1,
>
> I've got ASP.NET session state working ok in SQLServer mode, but the sessions never seem to expire.
>
> e.g if I add a timeout attribute like so :
>
> <sessionState mode="SQLServer"
> sqlConnectionString="Integrated Security=SSPI;data source=localhost" timeout="1" >
>
> the session doesn't seem to timeout. The timeout works fine in inProc session mode.
>
> Any ideas ?
> TIA
>
>



 
Reply With Quote
 
 
 
 
Moe Sisko
Guest
Posts: n/a
 
      04-28-2008
"Juan T. Llibre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> re:
> !> the session doesn't seem to timeout.
> !> The timeout works fine in inProc session mode.
>
> Session_End doesn't fire in SQL Server session state mode.
>


Juan,

Yes, I realise that Session_End doesn't fire in SQL Server state.

What I meant was, I was expecting the Session data to be automatically
cleared by SQL Server after the timeout minutes elapsed.
e.g. if I did : Session["abc"] = 5 , then after the timeout period
elapsed, I'm expecting : Session["abc"] to be null.

Otherwise the ASPStateTempSessions table in the session state database will
just keep growing. Old rows of this table doesn't seem to be getting cleaned
up.



 
Reply With Quote
 
Moe Sisko
Guest
Posts: n/a
 
      04-29-2008

"Moe Sisko" <null> wrote in message
news:%(E-Mail Removed)...
>
> What I meant was, I was expecting the Session data to be automatically
> cleared by SQL Server after the timeout minutes elapsed.
> e.g. if I did : Session["abc"] = 5 , then after the timeout period
> elapsed, I'm expecting : Session["abc"] to be null.
>


Never mind, figured it out - SQL Server Agent needs to be running. It runs a
stored proc every minute which gets rid of expired session data.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VoIPCheap/Stunt/SIPDiscount/Et.al - Mobile - Top-up Expiry Period -- Campaign for Correct Expiry Period on Finarea VOIP Service Mobile Top-Ups News Reader UK VOIP 16 06-26-2006 05:03 PM
ASP.NET Session Expiry in 2003 Server Amar ASP .Net 0 12-30-2004 06:02 AM
Session contents lost despite Session.Timeout = 3000; and <sessionState mode="InProc" cookieless="false" timeout="300"> Carpe Diem ASP .Net 3 02-23-2004 07:10 PM
Session expiry problem solved Anand ASP .Net 0 08-28-2003 08:55 AM
Frequent session time Expiry Thotatri ASP .Net 0 07-21-2003 12:27 PM



Advertisments