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

Checking Sessions Timeouts

When a user submits a page, I want to make sure their session has not
expired. I am using the code below to check, but it seems that
Context.Session is always null. Am I doing something wrong? I have this code
in the page load event on a base page that is being inherited by all my forms
pages.

if (Context.Session != null)
{
if (Session.IsNewSession)
Response.Redirect("~/sessionExpired.aspx");
}
else
Server.Transfer("../index.aspx");

Nov 1 '07 #1
1 932
If(IsPostBack && Session["whateveryouhadset"']==null)
Response.Redirect("~/sessionExpired.aspx");

-- no need for anything else except one known session variable.

-- Peter
// Abandon all hope, ye who enter here.
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Wannabe" wrote:
When a user submits a page, I want to make sure their session has not
expired. I am using the code below to check, but it seems that
Context.Session is always null. Am I doing something wrong? I have this code
in the page load event on a base page that is being inherited by all my forms
pages.

if (Context.Session != null)
{
if (Session.IsNewSession)
Response.Redirect("~/sessionExpired.aspx");
}
else
Server.Transfer("../index.aspx");
Nov 1 '07 #2

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

Similar topics

10
by: Mark H | last post by:
Hey all-- I'm building a database and I basically need to keep out people who aren't authorized, but it's not like I need top security here. I'm just doing basic user/pass of a SQL database, and...
2
by: Frantisek Fuka | last post by:
Sorry for posting this here but I got no reaction when asking in twisted-web mailing list: Twisted stores the Session objects using cookies. I'd like to know how long these Sessions last (it...
5
by: Dylan Parry | last post by:
Hi, I am by no means a Python programmer, but I am dabbling with it and trying to create a simple program that reports how many emails I have to download. So far, using the poplib extension, I...
6
by: Andrew | last post by:
Is there a way to query a webserver to see how many, and which, ASP Session ID numbers are still current? (ie: not expired). I'm working on a way to track active Website visitors & wish to...
4
by: Edgardo Sepulveda | last post by:
Hi, one question, is there a limit on the numbers of sessions that a client can have? i dont know why but suddently, as i handle a lot of the user information with sessions, and also have added a...
7
by: Atte André Jensen | last post by:
Hi I'm developing a site where I'd like to store information during a users visit. So far I've been using sessions, but as far as I can tell it's not possible to control for how long a session...
3
by: Dave Smithz | last post by:
Hi there, I have a website where users can log into. This users sessions as I believe most people use when implementing a login section of a website (each php page first checks a valid parameter...
13
by: Mickey | last post by:
Hi all, Currently I use a timestamp to log users out after 15 minutes of inactivity. However I also need to log a user out if they have just left the page. I need to do this because I store...
15
by: Mark Rae | last post by:
Hi, I'm presently converting a v1.1 ASP.NET app to v2, and am encountering a strange problem. When running in Debug mode (i.e. hitting F5), all is well. However, when running without...
4
by: kpg | last post by:
Hi all, Ah yes, the age old counting session question. sessionstate mode="InProc" timeout="5" Sub Application_Start() Application("ConcurrentUsers") = 0
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.