Forms Authentication: Redirect to Unauthorized.aspx in subdirectories?

Discussion in 'ASP .Net Security' started by Diane Y, Mar 16, 2006.

  1. Diane Y

    Diane Y Guest

    I'm using Forms Authentication in my ASP.Net app and I'm separating all my pages into different directories based on their authorization requirements (e.g., all my administrative pages will go under one directory and I have a <location> tag set up in my web.config to allow rights to only the "Admin" role for those pages).

    Currently, a user logs in and is redirected to the main Welcome page, which all users can see. If a non-Admin user tries to enter the Admin section of the app, they are redirected to the log in page. They've already logged in, though, so I'd rather have them redirected to a custom "You are not authorized to view this section" page. Is this possible?

    Here's my relevant web.config sections:


    <authentication mode="Forms">
    <forms name="Auth" protection="All" timeout="30" loginUrl="Login.aspx" path="/" />
    </authentication>

    <authorization>
    <allow users = "?" />
    </authorization>

    ..
    ..
    ..

    <location path="Maintenance">
    <system.web>
    <authorization>
    <allow roles="Admin" />
    <deny users="*" />
    </authorization>
    </system.web>
    </location>
     
    Diane Y, Mar 16, 2006
    #1
    1. Advertising

  2. Re: Forms Authentication: Redirect to Unauthorized.asp...

    hi,
    this is sri, now i am working on same task if u find any solution for this please post it tat will be helpfull to me
     
    do u find solution, Mar 28, 2006
    #2
    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,481
    Tommy
    Feb 13, 2004
  2. BJ Lap
    Replies:
    2
    Views:
    573
    BJ Lap
    Nov 20, 2005
  3. Evan M.

    Redirect Unauthorized Access

    Evan M., May 23, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    491
    bruce barker
    May 23, 2007
  4. Grant Harmeyer

    Forms Authentication on Subdirectories of App

    Grant Harmeyer, Feb 10, 2004, in forum: ASP .Net Security
    Replies:
    1
    Views:
    110
    Hernan de Lahitte
    Feb 12, 2004
  5. Eric
    Replies:
    2
    Views:
    535
Loading...

Share This Page