473,388 Members | 1,286 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,388 software developers and data experts.

Questions About Session Timeout

I have an asp.net 2.0 app written in C# and VS2005. I sometimes have
issues where users leave a page onscreen and then come back to it a
few hours later and try to continue working. Of course, it doesn't
work then. Currently they will encounter some sort of error message
because the session has timed out.

I need to develop a way to handle this!

Some questions:

1) If I want to set my session to timeout at 30 minutes, what should i
set for session timeout both in IIS config and in the web.config file,
for forms authentication.

2) When I am using my online banking website, my webpage automatically
logs me out after a set amount of time. How do I do that with my code?

Thanks in advance for your help!

Aug 30 '07 #1
4 2065
I have an asp.net 2.0 app written in C# and VS2005. I sometimes have
issues where users leave a page onscreen and then come back to it a
few hours later and try to continue working. Of course, it doesn't
work then. Currently they will encounter some sort of error message
because the session has timed out.

I need to develop a way to handle this!

Some questions:
2) When I am using my online banking website, my webpage automatically
logs me out after a set amount of time. How do I do that with my code?

Thanks in advance for your help!
You can have a javascript timer in your html page, that redirects to some
"session expired" page after the session should have timed out.
Just be careful: the session timeout is in minutes and javascript
works in milliseconds.
It's not possible to wire up some "SessionEnd" event to redirect the
browser anywhere, as that event happens on the server long after the
last request has been served.

Hans Kesting
Aug 30 '07 #2
1. I'd set them both to 30 minutes. The IIS config will handle the
session state, and the forms auth will handle the authentication cookie.

2. This is what the auth cookie lifetime is for, which you set in the
forms auth section of the web.config. Once this lifetime expires, the
cookie is deleted (effectively logging you out).
Steve C.
MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA
Joey wrote:
I have an asp.net 2.0 app written in C# and VS2005. I sometimes have
issues where users leave a page onscreen and then come back to it a
few hours later and try to continue working. Of course, it doesn't
work then. Currently they will encounter some sort of error message
because the session has timed out.

I need to develop a way to handle this!

Some questions:

1) If I want to set my session to timeout at 30 minutes, what should i
set for session timeout both in IIS config and in the web.config file,
for forms authentication.

2) When I am using my online banking website, my webpage automatically
logs me out after a set amount of time. How do I do that with my code?

Thanks in advance for your help!
Aug 30 '07 #3
Or just test Session.IsNewSession on the next round trip.

If the timeout for authentication is lower than the session timeout you
should even have thsi done for use as the authentication module will
redirect anyway the user to the login page...

---
Patrice

"Hans Kesting" <ne***********@spamgourmet.coma écrit dans le message de
news: c0**************************@news.microsoft.com...
>I have an asp.net 2.0 app written in C# and VS2005. I sometimes have
issues where users leave a page onscreen and then come back to it a
few hours later and try to continue working. Of course, it doesn't
work then. Currently they will encounter some sort of error message
because the session has timed out.

I need to develop a way to handle this!

Some questions:
>2) When I am using my online banking website, my webpage automatically
logs me out after a set amount of time. How do I do that with my code?

Thanks in advance for your help!

You can have a javascript timer in your html page, that redirects to some
"session expired" page after the session should have timed out. Just be
careful: the session timeout is in minutes and javascript
works in milliseconds.
It's not possible to wire up some "SessionEnd" event to redirect the
browser anywhere, as that event happens on the server long after the last
request has been served.

Hans Kesting


Aug 30 '07 #4
On Thu, 30 Aug 2007 06:23:18 -0700, Joey <jo*********@topscene.com>
wrote:
>I have an asp.net 2.0 app written in C# and VS2005. I sometimes have
issues where users leave a page onscreen and then come back to it a
few hours later and try to continue working. Of course, it doesn't
work then. Currently they will encounter some sort of error message
because the session has timed out.

I need to develop a way to handle this!

Some questions:

1) If I want to set my session to timeout at 30 minutes, what should i
set for session timeout both in IIS config and in the web.config file,
for forms authentication.

2) When I am using my online banking website, my webpage automatically
logs me out after a set amount of time. How do I do that with my code?

Thanks in advance for your help!
This wigit worked quite nicely for me. It stops the users who have
timed-out from generating exceptions.

http://www.eggheadcafe.com/articles/20051228.asp
Aug 31 '07 #5

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

Similar topics

12
by: Geigho | last post by:
Setting session timeout in web.config file does not seem to have any effect. Any explanation or suggestion will be appreciated.
3
by: john | last post by:
I have 2 questions: 1. I am trying to use forms authentication. When the user logs out, I make these function calls: Session.Abandon(); FormsAuthentication.SignOut(); But after they log out,...
4
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site...
8
by: Joe Abou Jaoude | last post by:
hi, I have a web app with forms authentication and a timeout session of 20 mins for security reasons. I recently added a feature that allows users (if they want to) to automatically log in...
11
by: Vishal | last post by:
Hello, can anybody tell me how I can extend the session expiry time? Is it done via code or via IIS? Sorry I am new and dont know about this.
17
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be...
4
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change...
25
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I tried: <sessionState timeout="1"> </sessionState> bounced IIS, and after 1 minute still had a session. ??? -- thanks - dave
6
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.