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 7665715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:38:44+00:00 2026-05-31T14:38:44+00:00

I have enabled form authentication in my ASP.NET MVC web application. I want to

  • 0

I have enabled form authentication in my ASP.NET MVC web application. I want to allow anonymous users access only to some specific pages, including Register.cshtml for instance. I was able to allow access to my CSS-file from my root web.config by doing this.

<location path="Content/Site.css">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>

Now I want to allow anonymous access to other pages, like Home and Register. Do any body know how to achieve this?

  • 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-31T14:38:45+00:00Added an answer on May 31, 2026 at 2:38 pm

    In MVC you normally use the [Authorize] attribute to manage authorization. Controllers or individual actions that are dressed with that attribute will require that the user is authorized in order to access them – all other actions will be available to anonymous users.

    In other words, a black-list approach, where actions that require authorization are black-listed for anonymous users using [Authorize] – all actions (not dressed with the attribute) will be available.

    Update:

    With MVC4 a new attribute has been introduced, namely the [AllowAnonymous] attribute. Together with the [Authorize] attribute, you can now take a white-list approach instead. The white-list approach is accomplished by dressing the entire controller with the [Authorize] attribute, to force authorization for all actions within that controller. You can then dress specific actions, that shouldn’t require authorization, with the [AllowAnonymous] attribute, and thereby white-listing only those actions. With this approach, you can be confident that you don’t, by accident, forget to dress an action with the [Authorize], leaving it available to anyone, even though it shouldn’t.

    Your code could then be something like this:

    [Authorize]
    public class UserController : Controller {
    
       [AllowAnonymous]
       public ActionResult LogIn () {
          // This action can be accessed by unauthorized users
       }
    
       public ActionResult UserDetails () {
          // This action can NOT be accessed by unauthorized users
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a standard ASP.NET MVC site with forms authentication. Users log in via
I have 4 forms in my asp.net mvc view. I have enabled client side
I have developed a web app in ASP.NET MVC which we are using internally.
I have an ASP.NET 2.0 web form that is taking almost 30 seconds to
I have a form in VB.Net with Autoscroll enabled and several ComboBoxes within it.
Bug: I've got an ASP.NET web application that occasionally sets identical cookie keys for
We have a custom list inside a moss publishing site that an asp.net form
I have a WCF 4 REST WebService within a folder in my ASP.Net MVC
I have a form in a jQuery enabled site. The form does not feature
I have a form, and want to disable/enable its submit button depending on whether

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.