How to: turn off custom errors for debugging mode in SharePoint 2010 application pages
Unfortunately custom errors is a setting that lives at the SharePoint site level, not at the ‘application page / _layouts’ level, so you will have to edit the web.config that applies to the entire...