mercredi 30 décembre 2015

Not routing the static files in ASP.NET MVC 3

I'm trying to write a simple ASP.NET MVC 3 code in which all requests to URL will be handed by the corresponding controller but the rest of requests need to be treated as if they are static and looked by webserver on the hard disk.

Here's my code:

public static void RegisterRoutes(RouteCollection routes)
        new { controller = "Calculator", action = "Index", id = "" }

But when I request it prompts 404 Not found. The thing is that I don't want to code a pattern for the static content, instead I want ASP.NET to look for the static content if there was no matching route. And then if no static content was found on the hard disk, only then it should be saying 404 Not found. How can I do this?

Aucun commentaire:

Enregistrer un commentaire