Telerik UI for ASP.NET AJAX

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 message:

"RadTreeView is undefined" if you are using Telerik UI for ASP.NET AJAX

Receiving this message indicates that there is a Web Resource related issue. The following sections describe ways to find out what is causing that error message.

Manually requesting the web resource handler

The fastest way would be to view the rendered output of your page and get the URL of the offending script tag. For instance:

CopyHTML
<div id="RadTreeView1_wrapper"><script type="text/javascript"
src="/Sample/WebResource.axd?d=axd__
axd&t=633437882200000000"></script>

If you paste that URL in your browser's address bar (after the domain and folder of course) the web server should serve back the content of that web resource. 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).

Using web development tools to request the web resource handler

You could use an HTTP traffic sniffer tool - Fiddler for Internet Explorer or FireBug for FireFox to find out if the request to a web resource file failed.

Dealing with the 404 error code (the requested URL was not found)

Please check the following:

  1. Check in the IIS management console that the .axd extension (the default HTTP handler extension) is allowed:

  2. Also check if the “Verify if file exists” checkbox is unchecked (click on the “Edit” button appearing in the previous screenshot to check).

  3. If you are using Telerik UI for ASP.NET Ajax check if the "ScriptResource.axd" HTTP handler is correctly registered in your web.config. Look for the following statement:

    ASP.NET 3.5:

    Copyweb.config
    <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"/>

    ASP.NET 4.0:

    Copyweb.config
    <add path="ScriptResource.axd" verb="GET,HEAD"
    type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    validate="false"/>

    ASP.NET 4.5:

    Copyweb.config
    <add path="ScriptResource.axd" verb="GET,HEAD"
    type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.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>:

    Copyweb.config
    <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" />

    Note: If you are using .NET 3.5 the version of the System.Web.Extensions assembly should be "3.5.0.0". If you are using .NET 4.0 the version should be "4.0.0.0" and if you are using .NET 4.5 the version should be "4.5.0.0". Always make sure you are referring to the right assembly version.

  4. If you are using Telerik UI for ASP.NET Ajax and RadScriptManager check if the Telerik.Web.UI.WebResource.axd HTTP handler is correctly registered in your web.config:

    ASP.NET 3.5:

    Copyweb.config
    <add path="Telerik.Web.UI.WebResource.axd" verb="*"
    type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    validate="false" />

    ASP.NET 4.0:

    Copyweb.config
    <add path="Telerik.Web.UI.WebResource.axd" verb="*"
    type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    validate="false" />

    ASP.NET 4.5:

    Copyweb.config
    <add path="Telerik.Web.UI.WebResource.axd" verb="*"
    type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    validate="false" />

    IIS7 Integrated Mode

    The following statement should be present in the <handlers> section instead of <httpHandlers>:

    Copyweb.config
    <handlers>  
    <add name="Telerik.Web.UI.WebResource"  
    path="Telerik.Web.UI.WebResource.axd" verb="*"   
    type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>

    Note: The version in the HTTP handler registration statement will vary depending on the release date and .NET runtime (3.5 or 4.0 or 4.5). Always make sure you are referring to the right assembly version.

Dealing with the 500 error code (server error)

Check the detailed error message where the two common cases are:

  1. "Padding is invalid and cannot be removed"

    The problem is likely to be related with the machine key. This MSDN article describes how to create a custom machine key.

  2. "Specified argument was out of the range of valid values. Parameter name: utcDate"

    The assembly containing the embedded resources is probably built in the future (its last modified time is later than the current time). This can occur when deploying in a different time zone. In such case run the following command line statement (the commas and plus at the end are important!): copy /b <path to assembly which is built in the future>+,,