Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net MVC : when is IIS giving a 404 and when does it forward it to my app?

i was wondering about the following:

i can define in IIS what to do with page not founds / 404, and also in my app i can put it in my CustomErrors section or just handle it in code.

Now as i assume IIS always gets the request first, when does it handle the 404 for itself, and when does it let it pass through to my app?

And a side-question: can IIS actually know if a request in asp.net MVC is a 404 because it might or it might not me mapped via any route?

like image 971
Michel Avatar asked Dec 17 '25 19:12

Michel


1 Answers

IIS looks at the request extension. If there is a module registered to handle the type of request that came in, then it will forward the request to that module.

For example, if you request foo.jpg from your server, then IIS has a module built in to handle image/jpg content. If that module can't find the file then it returns a 404.

Same thing here. Whatever your MVC handlers don't look for (ie: images), then IIS will take care of in another manner.

like image 80
NotMe Avatar answered Dec 19 '25 23:12

NotMe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!