473,623 Members | 3,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to check automatically for "end of session" and force a page redirection?

Hi guys.

Currently I need a javascript (client side) or vbscript(server side)
code to check automatically for session expiration and force the
redirection to a message page or the log-in page. All web site is built
around asp pages.

Thank you very much for your help

Jul 13 '06 #1
2 2076

Athenian wrote:
Hi guys.

Currently I need a javascript (client side) or vbscript(server side)
code to check automatically for session expiration and force the
redirection to a message page or the log-in page. All web site is built
around asp pages.
Use either setTimeout or setInterval to send an intermittent
XMLHttpRequest from the client to check with the server to see if the
session is still active at say 1 minute intervals. If the session has
timed-out, redirect.

It may be unreliable.
--
Rob

Jul 13 '06 #2
Athenian wrote:
Hi guys.

Currently I need a javascript (client side) or vbscript(server side)
code to check automatically for session expiration and force the
redirection to a message page or the log-in page. All web site is built
around asp pages.

Thank you very much for your help
Please clarify: do you want them to be taken to a log-in page
immediately when their session expires, or the next time they request a
page and their session has expired?

If it's the former (which is a bad idea - what if they are working on
something when their session expires? They are whisked away to a login
page whether they like it or not? Some action on their end - i.e.
requesting a page - should happen before you do this) then RobG's
suggestion is what you're looking for.

If it's the latter, you should ask in an ASP group. But it will go
something like this (note, this is C# code as I don't use VBScript):

if(Session["key_to_che ck"] == null)
Response.Redire ct("/myloginpage.asp ");

If you have authorization code already, I would be surprised if this
code isn't already included. If the user's session is no longer valid,
and they are still able to access protected pages, your site is a
desperately insecure.

Jeremy
Jul 14 '06 #3

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

Similar topics

27
7107
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
3
2373
by: Arnaldo Martinez | last post by:
Hi, friends: I have an ASP page where an user enter a value and click the submit button. I want this value to be transfer to a session("temp") within the same page where I want to call it back from the same ASP page.
9
3656
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
14
5908
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
4
1644
by: VB Programmer | last post by:
If I have a variable I want to share in my application what is the difference between just declaring a variable (Dim strMyVar as String) and using a session variable (Session("strMyVar"))? When should I use a session variable and when should I just declare it like normal? Thanks in advance!
3
2104
by: Jeff Smythe | last post by:
I simply want to execute some code once when a new session of my ASP.NET application is started (I'm not using session state for anything else - just writing some data to a database). I thought that I could simply put the code in the Session_Start event procedure in Global.asax.cs, however, the event procedure executes and a new session is created every time any page is requested - not just for the first page requested....
3
2419
by: Peter Theill | last post by:
Hi, I'm trying to include the content of a request into an Xml document: if (System.Web.HttpContext.Current.Session != null) { XmlDocument d = new XmlDocument(); d.Load(new XmlTextReader("http://localhost/page.aspx")); } The requested page (page.aspx) is an XHTML page so I'm able to parse it as a
13
1896
by: dee | last post by:
Hi My code complies the following line: Session("passed") = 1 but puts wiggly error line under the second Session("passed") in the following expression: Session("passed") = Session("passed") + 1 Why? Thanks Dee.
10
2387
by: thomson | last post by:
Hi, i create a session variable in C# as follows Session , but iam not able to access the variable in VB.net like intmode=Session("var"); Why is that ? Regards
0
8162
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8662
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
8603
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...
0
7134
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5560
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2593
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
1
1769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1468
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.