Short question:
How does IIS know if a request is webforms or MVC?
In IIS we have virtual directories pointing to the url's , so depending on the url IIS knows which web application you are requesting.
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.
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.
You can check Request. HttpMethod for that. if (Request. HttpMethod == "POST") { //the controller was hit with POST } else { //etc. }
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:
.aspx
files mapped to the PageHandlerFactory
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-
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With