473,748 Members | 9,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "
sqlConnectionSt ring="Integrate d Security=SSPI;d ata source=localhos t"
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 3459
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******** ******@TK2MSFTN GP02.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 "
sqlConnectionSt ring="Integrate d Security=SSPI;d ata source=localhos t" 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.comwrot e in message
news:ez******** ******@TK2MSFTN GP02.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 ASPStateTempSes sions 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******** ********@TK2MSF TNGP02.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
10054
by: Dam | last post by:
Using SqlServer : Query 1 : SELECT def.lID as IdDefinition, TDC_AUneValeur.VALEURDERETOUR as ValeurDeRetour FROM serveur.Data_tblDEFINITIONTABLEDECODES def, serveur.Data_tblTABLEDECODEAUNEVALEUR TDC_AUneValeur where def.TYPEDETABLEDECODES = 4
14
5918
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 MyBase.Load 'This event routine in the loginCheck user control fires when the
0
2188
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 tables created on my SQLServer. Here is what I've done. 1. I've created a web projectec consisting of two webforms. The first form (default.aspx) is my testform and it doesn't do much at all. (Actually it
1
3224
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 max number of connections. Obviously, we need to find the place(s) in our code where connections are not closed correctly (espcially in loops), but I'm wondering if it's possible to trap this error and to find out which part of our code (i.e....
1
3500
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 mentioned bellow. But the session expires in 30 min. Please let me know Regarding this. Thanks for your help.
0
1200
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 account specifically for that purpose.
1
2408
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 previously used in process state there was little back pressure against storing objects in the session. Now we're paying the price because serialization sucks in referenced objects resulting in possibly huge state storage and serialize/deserialize...
1
1432
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 MS SQL database, but can it be done somehow while using another database? If not, what are some ideas for the best way to handle this appropriately? I'm trying to keep the session information updated in a database, so that other web...
1
1149
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 else? We are using SqlServer SessionState. I cannot reproduce this and I can't find a KB article on this subject anywhere. Please help!
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9243
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.