When I was new to SharePoint programming, I faced plenty of problems to find out what errors or exceptions coming on a SharePoint web page. Because as of my knowledge those days, I thought like there is only one place where we can find the details of the exception or error coming and that is nothing but logs. [Which usually located in 12 hive.] But after got some experience with SharePoint slowly learning new things and found a way to see the exception directly on the screen[browser] instead of going to logs and check there.
When an exception comes in SharePoint environment usually the page we see is Unknown error, nothing else.
To see the actual exception details follow the steps below.
- Go to the location where your SharePoint application is present in the file system. It is usually at the location inetpub/wss/virtual directories/[port number].
- Find the web.config file.
- Take a backup of it.
- Open the file in some nice editor like Visual studio and find the tag <SafeMode
- This is the first child tag under <SharePoint>
- You can see the tag syntax something similar to this.
<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" …….
- One of the attributes for <SafeMode called CallStack, which holds the boolean value which tells to SharePoint framework whether to show the actual exception details or not.
- Set this value to true in-order to view the actual exception details on screen[browser].
- Set the CustomErrors section to Off to view complete details as shown below.
- <customErrors mode="Off" />
- IISRESET is not compulsory. If you do then that will be good.
Hope this will help to you to make fast development and no such big pains to look into all the log files for errors.
Note: Please use this option only on the development environment to make development fast. On production servers and QA environment, don't make the above changes to the file. If you do this, all your end users will see the actual exception or error details, which is not good.