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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:44:22+00:00 2026-05-14T02:44:22+00:00

In ASP.net MVC 2, I can use routes.RouteExistingFiles = true; to send all requests

  • 0

In ASP.net MVC 2, I can use routes.RouteExistingFiles = true; to send all requests through the routing system, even if they exist on the file system.

Usually, this ends up hitting the "{controller}/{action}/{id}" route and throws an exception as the controller cannot be found.

I do not want to use that route though (I have only a few URLs and they are specifically mapped), yet I would still like to prevent access to the file system.

Basically I want to Whitelist pages using IgnoreRoute. Is there a built-in way to do this?

My current approach is to still have a route "{*anything}" and generate a 404 when this is hit, but I’m just wondering if something is built-in already?

  • 1 1 Answer
  • 1 View
  • 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-14T02:44:22+00:00Added an answer on May 14, 2026 at 2:44 am

    This is one of the few valid uses of Web.config authorization in an ASP.NET MVC application. 🙂

    I’d recommend setting RouteExistingFiles back to false (so that Routing and the MVC pipeline don’t handle these requests, IIS and ASP.NET core do). Put all of the files for which you want to deny access into a single folder, then drop a Web.config into that folder:

    <configuration>
      <system.web>
        <authorization>
          <deny users="*"/>
        </authorization>
      </system.web>
    </configuration>
    

    This will prevent IIS and ASP.NET from serving these files directly.

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

Sidebar

Related Questions

In Asp.net MVC Razor we can use the _ViewStart.cshtml file to define the default
How i can use IDisposable interface with asp.net mvc.
I'm new to MVP . can I use tutorials created for asp.net MVC to
I use DevExpress v10.2.3 grouping gridview with asp.net mvc 4. I can get datas
In ASP.NET MVC, is it possible to define routes that can determine which controller
We are trying to use custom routes in an ASP.NET MVC application to generate
I'm trying to use route constraints in an Asp.Net MVC Application. routes.MapRoute( theRoute, MyAction/{page},
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
ASP.NET MVC 3 can generate scaffold code for us(controllers and views). The generated views
I am building a web site in C# using asp.NET MVC How can I

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.