R – Possible to use customErrors=On, but only for non-IIS handled errors

asp.neterror handlingweb.config

I toggled customErrors=On in web.config, set the defaultRedirect for my custom Error.aspx page. However, this is only to prevent application errors from spitting out code – I'd still like IIS to handle 404s etc. with its default handlers, since they work fine.

Any way to specify in my ASP.NET app or IIS for IIS to take priority?

I know I could add the formatting in my Error page…but I'd just be replicating what exists in IIS.

Best Answer

It didn't tried it (I don't have visual studio on that box) but maybe if you set your customErrors to handle only error 500 (server error), that'll work. Just a guess.

Let me know if it works