I'm trapping 404 errors in my MVC website. I have the option to either do that via adding the customerrors element in web.config or application_error, but I don't know which one is better. What is the difference between the two?

有帮助吗?

解决方案

I'd recommend you to use the application_error approach. This way you can log the 404'd request data, in a way that you can generate future reports. AFAIK, if you redirect the request using web.config settings, you lose this info.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top