This is not really new but currently I am working on some customized web parts, so I need to turn on/off the detailed error messages when I need to fix some hectic problems on my development environment. There are many posts regarding this, but I wanted to keep my own post for my future references. 😉
Normally SharePoint shows custom error messages to the users such as “An unexpected error has occurred” but this is not going to help, so we need to know the detailed ASP.NET error message to fix the problem. Here are the steps to turn off custom error messages.
Step 1: Go to the SharePoint host server and navigate to the Virtual Directories folder. Normally this is available in this path “C:\Inetpub\wwwroot\wss\VirtualDirectories”
Step 2: Find the web.config and get the backup for the safety purpose
Step 3: Open the web.config file using Visual Studio OR Notepad
Step 4: Find the “CallStack” and change the value to “true” instead of “false”
Step 5: Find the “CustomErrors” and change the value to “Off” instead of “On”
Step 6: Save and close the web.config, refresh the page then you will get the detailed (wired) error message. Time to fix this huh? 🙂
Error message before turning on:
Error message after turning on:
MSDN reference shows the “CustomErrors” values can be one of these:
|On||Specifies that custom errors are enabled. The custom errors are shown to the remote clients and to the local host.|
|Off||Specifies that custom errors are disabled. The detailed ASP.NET errors are shown to the remote clients and to the local host.|
|RemoteOnly||Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host.|
If you want, you can also set the “CustomErrors” value to “RemoteOnly” to show custom errors only to the remote clients.