Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does IIS know if a request is webforms or MVC? (ASP.NET)

Short question:

How does IIS know if a request is webforms or MVC?

like image 817
HerbalMart Avatar asked May 06 '11 11:05

HerbalMart


People also ask

How IIS recognize that which web application we are requesting?

In IIS we have virtual directories pointing to the url's , so depending on the url IIS knows which web application you are requesting.

How IIS process ASP.NET MVC request?

In asp.net life cycle, on basis of the extension (. aspx) , the request would be identified and handled by aspnet_isapi. dll and then httpapplication object is created followed by request and response objects and then request is processed by ProcessRequest() method.

How do I know if an application is MVC?

As a start if the solution contains Models,Controllers and Views Folder, it is very likely it is MVC. You can also look at which namespace is included... or you know, ask for a crash course on how the application operate.

How do you check if request is get or post in MVC?

You can check Request. HttpMethod for that. if (Request. HttpMethod == "POST") { //the controller was hit with POST } else { //etc. }


1 Answers

Short answer: IIS doesn't know; ASP.NET knows via HTTP Handlers

Both WebForms and MVC are built on top of ASP.NET, and both use HTTP Handlers to deal with per-request execution:

  • WebForms has .aspx files mapped to the PageHandlerFactory
  • MVC integrates into the Routing infrastructure as an IRouteHandler implementation. Routes is notified of requests via the UrlRoutingHandler

ASP.NET, in turn, is notified of all requests in IIS7+ and via mapped file extensions in IIS6-

like image 50
Richard Szalay Avatar answered Nov 03 '22 01:11

Richard Szalay