Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > When session is invalid, how to redirect user to the login page

Reply
Thread Tools

When session is invalid, how to redirect user to the login page

 
 
Billy Zhang
Guest
Posts: n/a
 
      11-11-2008
I have a asp.net app. When session is invalid, how to redirect user to the
login page? I don't want to add the code to redirect user to the login page
into every page.

Thanks,
-Billy
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      11-11-2008
this is what the global.asax is for. PostAcquireRequestState would be a
good event.

-- bruce (sqlwork.com)

Billy Zhang wrote:
> I have a asp.net app. When session is invalid, how to redirect user to the
> login page? I don't want to add the code to redirect user to the login page
> into every page.
>
> Thanks,
> -Billy

 
Reply With Quote
 
 
 
 
Steven Cheng
Guest
Posts: n/a
 
      11-11-2008
Hi Billy,

Are you using custom forms authentication which is based on some
information stored in session? Anyway, if you do need a central place
where you can check session state and redirect request, you can consider
the approach Bruce introduced(use some global events ).

And instead of using global.asax, you can also write a custom httpmodule to
hook any of the global events in ASP.NET. Here are two kb articles
introduce this:

#INFO: ASP.NET HTTP Modules and HTTP Handlers Overview
http://support.microsoft.com/kb/307985

#How To Create an ASP.NET HTTP Module Using Visual C# .NET
http://support.microsoft.com/kb/307996

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we

can improve the support we provide to you. Please feel free to let my
manager know what you think of

the level of service provided. You can send feedback directly to my manager
at: http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/en-us/subs...#notifications.

--------------------
>From: =?Utf-8?B?QmlsbHkgWmhhbmc=?= <(E-Mail Removed)>
>Subject: When session is invalid, how to redirect user to the login page
>Date: Mon, 10 Nov 2008 19:04:00 -0800


>I have a asp.net app. When session is invalid, how to redirect user to

the
>login page? I don't want to add the code to redirect user to the login

page
>into every page.
>
>Thanks,
>-Billy
>


 
Reply With Quote
 
jacerhea
Guest
Posts: n/a
 
      11-12-2008
You may also consider using a base page. Basically, create a class
that inherits from System.Web.UI.Page and have all of your aspx pages
inherit from that class. You can than put your session check code in
there.

http://aspnet.4guysfromrolla.com/articles/041305-1.aspx

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Cannot open user default database. Login failed. Login failed for user 'HEMPC\ASPNET' Tony Johansson ASP .Net 3 01-02-2010 04:09 PM
How to Redirect User to Originally Viewed Page After Login? vunet.us@gmail.com ASP General 1 12-28-2006 01:10 AM
Login page & Session data...response.redirect, server.transfer or ??? GreggTB ASP .Net 10 05-24-2005 06:57 AM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM



Advertisments