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

Discussion in 'ASP .Net' started by Billy Zhang, Nov 11, 2008.

  1. Billy Zhang

    Billy Zhang Guest

    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
     
    Billy Zhang, Nov 11, 2008
    #1
    1. Advertising

  2. Billy Zhang

    bruce barker Guest

    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
     
    bruce barker, Nov 11, 2008
    #2
    1. Advertising

  3. Billy Zhang

    Steven Cheng Guest

    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: .

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

    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    --------------------
    >From: =?Utf-8?B?QmlsbHkgWmhhbmc=?= <>
    >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
    >
     
    Steven Cheng, Nov 11, 2008
    #3
  4. Billy Zhang

    jacerhea Guest

    jacerhea, Nov 12, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GreggTB
    Replies:
    10
    Views:
    4,324
    Damien
    May 24, 2005
  2. savvy
    Replies:
    8
    Views:
    22,891
    kamer
    Nov 18, 2006
  3. Tony Johansson
    Replies:
    3
    Views:
    16,357
    Patrice
    Jan 2, 2010
  4. Sal
    Replies:
    1
    Views:
    819
  5. Replies:
    1
    Views:
    143
    Kyle Peterson
    Dec 28, 2006
Loading...

Share This Page