In this article I will explain how to resolve the following error message occurring in ASP.Net website or web application when it is hosted on a remote in IIS server.
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
 
ASP.Net: The current custom error settings for this application prevent the details of the application error
 
 
Cause
The following error occurs in ASP.Net website or web application when it is hosted on a remote in IIS server.
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
This page is shown to the end user when some error or exception occurs in the program and since the default value of the customError setting is On, ASP.Net hides the actual error from the end user.
This a security feature and is built to secure the websites from hackers by hiding the actual error details from them.
 
 
Solution
Developers can disable this feature by adding the customError setting the system.web section of the Web.Config file and setting the appropriate Mode.
The customError setting has three Modes.
On (Default) – Even the customError setting is not present in the Web.Config file the default Mode is On and the actual error details will always be hidden i.e. it will not be shown when the website is accessed on server or any client machine.
RemoteOnly (Recommended) – This setting will hide the error details from the end users i.e. when accessed from client machines but when the website is accessed on server where it is hosted then the actual error details will be shown.
Off – This setting will turn off the feature and the complete error details will be shown to everyone. Generally turning this setting Off is not recommended.