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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:42:40+00:00 2026-05-22T15:42:40+00:00

I am developing an ASP.NET MVC application that has two kind of pages: (1)

  • 0

I am developing an ASP.NET MVC application that has two kind of pages: (1) a login page, and (2) everything else. Even my home page displays content that requires authorized access:

public class HomeController : Controller {
    [CustomAuthorize] // My custom authorization tag
    public ActionResult Index() {
        // ...
    }
}

But now I have the following “little” problem. When I navigate to http://my-site/, the following sequence of events takes place:

  1. Since no controller and no action were specified, the default values (“Home” and “Index”, respectively) are used.

  2. Since HomeController.Index() has the CustomAuthorizeAttribute attribute, then I get redirected to my login page.

  3. My login page attempts to load, among other things http://my-site/Content/Site.css.

  4. In this new request, since there is no controller called ContentController, ASP.NET processes the request as if Content and Site.css were parameters of a request to http://my-site/. Which, of course, requires authentication, and…

Is there any way to make ASP.NET MVC Routing process requests to http://my-site/Content/* or http://my-site/Scripts/* differently than other requests?


EDIT: Here is my global.asax file:

public class MvcApplication : HttpApplication {
    public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
        filters.Add(new HandleErrorAttribute());
    }

    public static void RegisterRoutes(RouteCollection routes) {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );
    }

    private void Application_Start() {
        AreaRegistration.RegisterAllAreas();

        RegisterGlobalFilters(GlobalFilters.Filters);
        RegisterRoutes(RouteTable.Routes);
    }
}
  • 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-22T15:42:41+00:00Added an answer on May 22, 2026 at 3:42 pm

    Do you have access restrictions in your web.config? If so, you shouldn’t. Typically in an MVC app, you handle that entirely with attributes. I think if actual files exist on disk at the path the request won’t even be routed through MVC. Given your description it seems most likely that your web.config is set up to deny access to unauthenticated users and that should be removed.

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

Sidebar

Related Questions

Im developing a web application in asp.net mvc (c#) that has a form and
I'm developing an ASP.NET MVC application that will send the user a confirmation email.
We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData
I'm developing an ASP.NET MVC 2 application that connects to some services to do
I'm having a problem with an ASP.NET MVC application that I'm developing. I'm still
I am developing an asp.net mvc application, which has these enity classes: public class
I've been developing an application using asp.net MVC, and I have some configurations that
I am developing a personal blog in ASP.NET MVC 1.0. This blog application has
I am developing an asp.net mvc web application that makes much use of jquery
I am developing an Asp.Net MVC application that uses Google maps to show Addresses

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.