Is it possible to catch the YSOD that occurs from a asp.net app’s web.config being missing/broken/corrupt and actually show a more helpful meaningful message which might help the user fix the issue.
Recently used WordPress and it showed a lovely error message when I accidentally deleted the wp_congif.php file. I love how it could detect it, handle it, continue running and tell me what I’d probably done and how to fix it. Would do wondered to have on live sites and for sanity checking when deploying etc.
Pondered using custom error trapping but I’m not sure it would work as without a web.config will the app even run?
That would have to happen at the IIS configuration level, as without a valid web.config the application throws an exception before it can handle the exception. You can’t really do anything about it from within the application.
If there was a custom application configuration file missing/broken, then your ASP.Net code could handle it through detection in application startup, but with a broken web.config you’re not going to get that far (missing, you could detect through looking for a value in appsettings and dying gracefully if it’s not there).