Forms authentication: how to redirect unauthorized users?

Discussion in 'ASP .Net' started by BJ Lap, Nov 17, 2005.

  1. BJ Lap

    BJ Lap Guest

    Hi,

    I implemented forms authentication in my web site.
    This works fine but for one thing:
    If an authenticated user tries to navigate to a page for which this user has
    no access,
    (this is specified in web.config files in several directories in the web
    site), the user is redirected to the logon page. But I want the user to be
    redirected to an 'acces denied' page. How can that be accomplished?

    Thanks,
    Bert-Jan
     
    BJ Lap, Nov 17, 2005
    #1
    1. Advertising

  2. BJ Lap

    Brock Allen Guest

    You need to check on your login page to see if Request.IsAuthenticated. This
    will tell you they've been redirected and they're already logged in. You
    can then let them know they've tried to access a page that they don't have
    access to.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > Hi,
    >
    > I implemented forms authentication in my web site.
    > This works fine but for one thing:
    > If an authenticated user tries to navigate to a page for which this
    > user has
    > no access,
    > (this is specified in web.config files in several directories in the
    > web
    > site), the user is redirected to the logon page. But I want the user
    > to be
    > redirected to an 'acces denied' page. How can that be accomplished?
    > Thanks,
    > Bert-Jan
     
    Brock Allen, Nov 18, 2005
    #2
    1. Advertising

  3. BJ Lap

    BJ Lap Guest

    Thanks! This works fine now.
    Bert-Jan

    "Brock Allen" <> wrote in message
    news:...
    > You need to check on your login page to see if Request.IsAuthenticated.
    > This will tell you they've been redirected and they're already logged in.
    > You can then let them know they've tried to access a page that they don't
    > have access to.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >> Hi,
    >>
    >> I implemented forms authentication in my web site.
    >> This works fine but for one thing:
    >> If an authenticated user tries to navigate to a page for which this
    >> user has
    >> no access,
    >> (this is specified in web.config files in several directories in the
    >> web
    >> site), the user is redirected to the logon page. But I want the user
    >> to be
    >> redirected to an 'acces denied' page. How can that be accomplished?
    >> Thanks,
    >> Bert-Jan

    >
    >
     
    BJ Lap, Nov 20, 2005
    #3
    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. Eric
    Replies:
    2
    Views:
    1,529
    Tommy
    Feb 13, 2004
  2. Evan M.

    Redirect Unauthorized Access

    Evan M., May 23, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    507
    bruce barker
    May 23, 2007
  3. Eric
    Replies:
    2
    Views:
    596
  4. Diane Y
    Replies:
    1
    Views:
    228
    do u find solution
    Mar 28, 2006
  5. mike
    Replies:
    1
    Views:
    820
    Mr. Arnold
    Jun 6, 2009
Loading...

Share This Page