Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

session expiry when using sessionState mode="SQLServer"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Moe Sisko - 28 Apr 2008 09:02 GMT
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
Juan T. Llibre - 28 Apr 2008 13:01 GMT
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/
======================================
> Using dotnet 2.0 sp1,
>
[quoted text clipped - 9 lines]
> Any ideas ?
> TIA
Moe Sisko - 29 Apr 2008 00:58 GMT
> 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.
Moe Sisko - 29 Apr 2008 01:42 GMT
> 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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.