Is it possible that static files not be processed by the asp.net mvc engine?
Can I do this at the IIS level or something? (without ofcourse creating a seperate IIS website for static files)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You need to create an ignore route for the specific types of files you don’t want to be served through ASP.NET MVC.
Add the following to your routes, for the types of files you want to ignore.
The following works for files in the root:
If you want to ignore files in a specific directory, you can do this:
If you want to combine these into one route, you can (e.g., ignore specific types of files in a directory):
This overload of
IgnoreRouteaccepts a url (the first argument) and a Constraints object of things to ignore.Since the RouteConstraints in ASP.NET MVC can be implemented multiple ways (including a regex), you can put standard regexes in the second argument.
If you want to implement a custom constraint, there is lots of useful documentation on that subject (say, if your constraint is dynamic at runtime).