473,396 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

session expiry when using sessionState mode="SQLServer"

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
Jun 27 '08 #1
3 3431
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" <nullwrote in message news:ua**************@TK2MSFTNGP02.phx.gbl...
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


Jun 27 '08 #2
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:ez**************@TK2MSFTNGP02.phx.gbl...
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.

Jun 27 '08 #3

"Moe Sisko" <nullwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>
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.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dam | last post by:
Using SqlServer : Query 1 : SELECT def.lID as IdDefinition, TDC_AUneValeur.VALEURDERETOUR as ValeurDeRetour FROM serveur.Data_tblDEFINITIONTABLEDECODES def,...
14
by: dale zhang | last post by:
Hi groups, Can anyone give me the equivalent C# sharp code for this VB.ET code, :: VB.NET :: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles...
0
by: Kristofer Liljeblad | last post by:
Hi, I've successfully setup my machine to use: sessionState mode="SQLServer". All is up and running so no problems so far. Because I curious person, I started to play around with the two new...
1
by: Sean Nolan | last post by:
We have implemented unhandled error trapping at the application level and log these errors to our database. One error, however, the does not get trapped is when the connection pool has exceeded the...
1
by: TSelvan | last post by:
Hi All, We have developmented Web project with ASP.Net and SQL server Database. In this project we have configured "SessionState" mode as "SQLServer" in Web.Config with timeout="180" as...
0
by: Peter Rilling | last post by:
I am wondering what the consequences are of using the "nt authority\network service" account in an Application Pool so that IIS can connect to a SQLServer database as opposed to creating a domain...
1
by: Bill Cohagan | last post by:
We are attempting to convert an already existing application over to using multiple worker processes; thus we need to store state via session state server rather than in process. Since this app...
1
by: Craig | last post by:
I'm planning on persisting sessionState in a database (not MS SQL). Is there a way to do this using the web.config file? I see that you can set the sessionState mode="SQLServer" to persist to a...
1
by: fathelga | last post by:
We have a site that holds data about the user in session while they are logged in. Everyone once in a while a user will log in and see someone else's session state. Has this happened to anyone...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.