In this post I will show you how to troubleshoot Web Resource related problems and how to deal with them.
If you are using an ASP.NET server control with rich client-side behavior it is likely built to utilize web resources. Sometimes your page loads and that rich server side control does not work at all - the tree view does not expand, the grid cannot sort etc. Most of the times this is because the JavaScript files of those controls have failed to load. If your browser is configured to prompt on JavaScript errors you may see the following error messages:
Receiving one of those messages indicates that there is a Web Resource related issue. The next step is to find out what exactly is causing that error message.
The fastest way would be to view the rendered output of your page and get the URL of the offending script tag. Here is a short demo with RadTreeView Classic:
<div id="RadTreeView1_wrapper"> |
<!-- 6.3.5 --><script type="text/javascript" src="/Sample/WebResource.axd?d=mOXVXvUPV2JWSrl55DXbLd4CU3OqV82yycNo3oZC9Qn3B05GrDVSd8t21hVYrCq41DKrZevSapn__c8UQPRmtdYqo9Oc7wmveT4PyIINoBOcBUJOfqTubx1YzP6v6wYp0&t=633437882200000000"></script> |
Then paste that URL in your browser's address bar (after the domain and folder of course). Normally the web server should serve back the content of that web resource. However in case of a problem with the web resource HTTP handler you would see an error page saying that the server returned HTTP error code 404 (not found) or 500 (server error).
Another useful technique is to use an HTTP traffic sniffer tool - Fiddler for Internet Explorer or FireBug for FireFox. Here are two screenshots showing a failed request to a web resource file:
Fiddler
Please check the following:
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> |
<add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /> |
IIS7 Integrated Mode
The following statement should be present in the <handlers> section instead of <httpHandlers>:
<handlers> |
<add name="ScriptResource" preCondition="integratedMode" |
verb="GET,HEAD" path="ScriptResource.axd" |
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> |
<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.1.619.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" /> |
<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.1.619.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" /> |
IIS7
The following statement should be present in the <handlers> section instead of <httpHandlers>:
<handlers> |
<add name="Telerik.Web.UI.WebResource" |
path="Telerik.Web.UI.WebResource.axd" verb="*" |
type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2008.1.619.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/> |
You should check the detailed error message. There are two common cases:
I hope this helps.