Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 22nd, 2005, 05:45 PM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default What if Session Timed Out??

Hi:
I'm trying to figure out how to determine whether the user's session has timed out or not.
I need them to log back in if it has.
I tried the code below but it didn't work:
The user ends up with a really ugly .NET error.

How can I solve this?
Code:
try
{
   UserID = Session["UserID"].ToString();
}
catch
{
   Response.Redirect("ExtErrors.aspx?Err=NoAccess",false);
}
__________________
http://www.softlinksys.com
Professional Software Developer since 1994.
 
Old January 22nd, 2005, 09:50 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

While using the session object in ASP.Net you have to check for its existence else it would throw an exception only. i.e., check whether that session is not equal to empty or null before trying to access it.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 23rd, 2005, 12:26 PM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I'll try that.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Timed alerts. jpool Visual Basic 2005 Basics 4 June 28th, 2008 09:26 AM
TIMED response.redirect misskaos Classic ASP Basics 2 December 9th, 2006 08:13 PM
Timed Executable KennethMungwira Beginning VB 6 1 July 28th, 2006 10:55 AM
Tool Has Timed Out m_gorbani ASP.NET 2.0 Professional 1 March 14th, 2006 07:07 AM
Automatic Timed Event echovue Access 4 September 27th, 2005 12:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.