andrew
andrew

Reputation: 1260

Execution sequence of MVC Routes and HTTP Modules

Does the handler for MVC Routes trump the HttpModules defined in web.config?

I have an asp.net app that consists of legacy webforms code and MVC code. I want to prove to myself that MVC is taking precedence for handling requests over a custom HttpModule the project uses, which can also handle requests.

Upvotes: 1

Views: 869

Answers (1)

jgauffin
jgauffin

Reputation: 101150

IIRC the MVC routing is done in the HTTP module which launches MVC. So MVC will "win" as long as it's http module is added before your custom one.

I was almost correct. MVC implements a UrlRoutingHandler which means that it will direct the request before any module is invoked.

Source code:

http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/5b4f63fa0b89#src%2fSystem.Web.Mvc%2fMvcHttpHandler.cs

Upvotes: 2

Related Questions