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

Session Timeout Question

Hi,

I am creating a test applicaiton with 3 pages say login.aspx test1.aspx and
test2.aspx.
I added this to my global.asax file

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Session.Timeout = 1
Response.redirect("Login.aspx")
End Sub

question:
1. do I have to change the timeout value in web.config file also?
2. I browsed to test2.aspx and then waited for session to time out, but the
page was not redirected to "Login.aspx"...... why?
i even had a break point, it fired but did nothing.

Please advice,
Stephen
Nov 19 '05 #1
2 3925
Hi Stephen,

Answer:
1. You can set it on web.config, but the meaning is not the same. Setting
the Session.Timeout is per request only while web.config is per the web
application.
2. You cannot do response.redirect on Session_End, since the response is
already served.

If you want to redirect to login.aspx after one second, you may want use:
<meta http-equiv="refresh" content="1;url=login.aspx">

or using javascript by timeout.

Regards,
Jack Li
MVP (ASP.NET)

"Stephen Noronha" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I am creating a test applicaiton with 3 pages say login.aspx test1.aspx
and
test2.aspx.
I added this to my global.asax file

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Session.Timeout = 1
Response.redirect("Login.aspx")
End Sub

question:
1. do I have to change the timeout value in web.config file also?
2. I browsed to test2.aspx and then waited for session to time out, but
the
page was not redirected to "Login.aspx"...... why?
i even had a break point, it fired but did nothing.

Please advice,
Stephen

Nov 19 '05 #2
Thanks Jack
Stephen

"Jack Li" <li****@h.o.t.m.a.i.l.com> wrote in message
news:eC****************@TK2MSFTNGP15.phx.gbl...
Hi Stephen,

Answer:
1. You can set it on web.config, but the meaning is not the same. Setting
the Session.Timeout is per request only while web.config is per the web
application.
2. You cannot do response.redirect on Session_End, since the response is
already served.

If you want to redirect to login.aspx after one second, you may want use:
<meta http-equiv="refresh" content="1;url=login.aspx">

or using javascript by timeout.

Regards,
Jack Li
MVP (ASP.NET)

"Stephen Noronha" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I am creating a test applicaiton with 3 pages say login.aspx test1.aspx
and
test2.aspx.
I added this to my global.asax file

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Session.Timeout = 1
Response.redirect("Login.aspx")
End Sub

question:
1. do I have to change the timeout value in web.config file also?
2. I browsed to test2.aspx and then waited for session to time out, but
the
page was not redirected to "Login.aspx"...... why?
i even had a break point, it fired but did nothing.

Please advice,
Stephen


Nov 19 '05 #3

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

Similar topics

4
by: HolaGoogle | last post by:
hi there, i've 2 questions for you guys.... 1: is there any way to "force" a session_onend(), session timeout or at least call my logout method when a user leaves the application window without...
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.
5
by: Just D. | last post by:
Do we have any access to the Session object from a different Session? The idea is to save Session of a current user and then if he logs in again then return the Session back. It's not a problem to...
15
by: dee | last post by:
Hi, What is the maximum number of minutes for Session timeout that I can specify in web.config? Thanks. Dee
3
by: bennett | last post by:
In the web.config file for my application, in the <sessionState> section I have set timeout="120" (in minutes), but session state variables in my application seem to be expiring in about 5 minutes....
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
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...
9
by: antonyliu2002 | last post by:
By default, IIS is configured to timeout a session in 20 minutes, which can be changed through the IIS config window. I use InProc sessionState mode. I can also set the session timeout in...
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
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
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.