Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 129427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:47:16+00:00 2026-05-11T05:47:16+00:00

Redirect user to Login Page dependent on the Folder they are in. I have

  • 0

Redirect user to Login Page dependent on the Folder they are in. I have a web application with the root directory which is used by all users and the admin site.

For people that would require the authenticated functionality of the site, they would require to login and be redirected to root/login.aspx. However, when an Admin needs to login to the root/admin/ section of the site, I want them to be redirected to the login form on root/admin/login.aspx

  <configuration>       <appSettings/>       <connectionStrings/>     <system.web>       <authorization>         <deny users='?' />       </authorization>     </system.web>   </configuration> 

I have this file in the root/admin directory. I have tried adding the following line but it is giving an error.

  <authentication>     <forms defaultUrl='default.aspx' loginUrl='default.aspx'></forms>   </authentication> 

Basically I am trying to overwrite the defaulturl and loginurl that exists in the main app.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:47:17+00:00Added an answer on May 11, 2026 at 5:47 am

    You need to use the <location> element in your web.config. You can use the <location> tag to apply authorization settings to an individual file or directory.

    <location path='/root'>   <system.web>       <authentication mode='Forms' >         <forms name='LoginForm' defaultUrl='default.aspx'          loginUrl='/root/login.aspx' protection='Encryption'          timeout='30' path='/'/>       </authentication>     <authorization>       <allow users='?' />     </authorization>   </system.web> </location> <location path='/root/admin'>   <system.web>     <authentication mode='Forms' >       <forms name='formName' defaultUrl='login.aspx'        loginUrl='/root/admin/login.aspx' protection='Encryption'       timeout='30' path='/'/>     </authentication>     <authorization>       <allow users='?' />     </authorization>   </system.web> </location> 

    MSDN

    For centralized administration, settings can be applied in the Machine.config file. The settings in the Machine.config file define machine-wide policy and can also be used to apply application-specific configuration using <location> elements. Developers can provide application-configuration files to override aspects of machine policy. For ASP.NET Web applications, a Web.config file is located in the application’s virtual root directory and optionally in subdirectories beneath the virtual root.

    If you would like 1 login location and different access levels you might want to use roles.

    <location path='/root'>   <system.web>     <authorization>        <allow roles='admin,root' />/*admin, root is allowed */        <deny users='*' />     </authorization>   <system.web> </location>    <location path='/root/admin'>   <system.web>     <authorization>        <allow roles='admin' />/*admin is allowed */        <deny users='*' />     </authorization>   <system.web> </location>   

    Users can belong to more than one role. For example, if your site is a discussion forum, some users might be in the role of both Members and Moderators. You might define each role to have different privileges on the site, and a user who is in both roles would then have both sets of privileges.

    You can access all these element at the code level if you would like to manipulate the roles/authentication programmatically

    Page.User.Identity.Name Page.User.Identity.IsAuthenticated Page.User.Identity.AuthenticationType Page.User.IsInRole('string'); 

    Tutorials

    4 Guys From Rolla Tutorial

    The ASP.NET web.config File Demystified

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What we need: redirect to each user's specific page after their login. What we
I need to redirect a user to a different page if they visit a
I have a download folder. So is it possible to redirect a user to
I have been trying to make a user login page that, when the user
i have blog system which is every user have their own main page like
I'm writing an asp.net Web Application. I wrote a login page that authenticates a
Ok, I have an default.aspx page that I'm trying to have redirect the user
I want to redirect the user to login page on landing, While user is
I have one requirement to fulfill. Actually when ever user Login into my application
Before user login, if type xxx.detail.jsf , it will redirect to the login page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.