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

  • SEARCH
  • Home
  • 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 359941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:26:29+00:00 2026-05-12T12:26:29+00:00

The URL for the administration section of my website always starts with Admin/ .

  • 0

The URL for the administration section of my website always starts with Admin/. Is it possible in ASP.NET MVC to restrict access to users by using this part of the URL?

Obviously I would keep the [Authorize(Roles = "Administrator")] on appropriate controllers and actions but I wonder if it would be quicker for the application if it can just look at the URL instead of stepping into code.

  • 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. Editorial Team
    Editorial Team
    2026-05-12T12:26:29+00:00Added an answer on May 12, 2026 at 12:26 pm

    Found the answer in Steven Sanderson’s book, Pro ASP.NET MVC Framework.

    Put the following code in your web.config file.

    <location path ="Admin">
      <system.web>
        <authorization>
          <deny users="?"/>
          <allow roles="Administrator"/>
          <deny users="*"/>
        </authorization>
      </system.web>
    </location>
    

    This means for any URL matching ~/Admin/*, the application will deny access to unauthenticated visitors or
    any other visitors other than those with the role ‘Administrator’.

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

Sidebar

Related Questions

I am using ASP.NET MVC 3. I created an area called Administration . There
Sharepoint central administration contains possibility to configure URL for different zones (Alternate access mappings).
Is it possible to add a custom object (String or URL) to JNDI using
I have Elmah up and running in my ASP.NET MVC site and I would
I'm using Joomla , and using a htaccess in administrator directory for restrict access
Can I have different login URL for different ASP .NET MVC3 areas? e.g. I
URL u=new URL("telnet://route-server.exodus.net"); This line is generating : java.net.MalformedURLException: unknown protocol: telnet And I
I wrote a payment module for X-Cart. My return url section is: require './auth.php';
I want to enter to administration application of my site. on request: http://mysite.ru/admin/ -
http://jsfiddle.net/defencedog/2Skc7/ I am trying to remove the online class ONLY for administration which has

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.