Telerik.Web.UI.WebResource.axd and web.config Once and for all

2 Answers 4464 Views
General Discussions
TonyG
Top achievements
Rank 1
TonyG asked on 08 Feb 2010, 01:07 AM

This topic is a constant source of confusion for me. Often referenced web pages sometimes seem out of date or conflicting. It's not clear whether the information is accurate for a specific release or for all time. I was going to blog this but maybe it's better if we can create a single forum thread here to become the definitive statement for the web.config definition of Telerik.Web.UI.WebResource.axd.

Here's one excellent reference on the topic:
http://www.telerik.com/help/aspnet-ajax/radscriptmanager.html
Really I think this information applies to most or all controls, but if you're aware of any exceptions for Telerik controls, please post a response here.

For IIS6, consider the following <httpHandler> lines:

<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/> 

and

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

When Telerik.web.ui is set to Copy Local (not GAC), is it better to not specify the PublicKeyToken?
Is it OK if we do when the DLL isn't in the GAC?  I think so.
Does the PublicKeyToken ever change?  I don't think so.

For IIS7, consider the following <system.webServer><handlers> lines:

<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd"
     type="Telerik.Web.UI.WebResource"
   
 verb="*" preCondition="integratedMode,runtimeVersionv2.0"/>

and

<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd"
     type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
     verb="*" preCondition="integratedMode"/> 

I don't think the answer to the above questions is different for IIS, but if they are, please let us know.

Given the above, if you're not using the GAC, you should probably never have to change these web.config entries for a given site after they are initially set. See below if you're using the GAC.

Regarding that preCondition runtimeVersion2.0 spec, I'm thinking it doesn't need to be there. The documentation for that attribute says: "Specify the runtimeVersionv2.0 value when the handler should respond only to requests in application pools that are configured to use .NET Framework version 2.0.". I think this is a hold-over from when people were transitioning from v1.1 to 2.0. These days all application pools should be configured for .NET2.  The question becomes: what happens with .NET 3.x or .NET 4? Is it better to add that attribute parameter for the future, or to leave it out for the future?

The help page referenced above provides this sample for IIS7 when Telerik.web.ui.dll is in the GAC:

<add name="Telerik.Web.UI.WebResource"
    
path="Telerik.Web.UI.WebResource.axd" verb="*"
    
type="Telerik.Web.UI.WebResource, Telerik.Web.UI, 
           Version=[ASSEMBLY_VERSION], Culture=neutral, PublicKeyToken=121fae78165ba3d4"
 />

For anyone not familiar with the syntax, the question might arise:
- Should the name attribute have underscores or periods?
I don't know. See this page for an example where underscores are used:
http://dotnetnotes.i-do-it.com/2009/05/17/CouldNotLoadFileOrAssemblyTelerikWebUI.aspx
I've seen that syntax elsewhere but I'm not sure if it's for web page formatting or if it's valid web.config formatting.

Note that for GAC references the assembly version is required, since the GAC can contain multiple assemblies for the same component but different versions.  The ASSEMBLY_VERSION must be the full version ID for your RadControls release.  For example:
Version=2009.3.1103.35
or
Version=2009.3.1314.35
In this case the PublicKeyToken is required.  More information on the topic is available here:
http://www.telerik.com/help/aspnet-ajax/web-resources-troubleshooting.html

What that means is that if you use the GAC to avoid having multiple copies of DLLs laying around, or to avoid having one application with DLLs for with 2009Q1 and another with 2009Q3, then you need to change web.config to use a specific version of RadControls whenever you upgrade your environment - that is, if you want a specific application to use the new version.

Why did I write this?  I was recently chasing down errors where FireBug is reporting 401 Unauthorized errors for WebResource.axd and Teleric.Web.UI.WebResource.axd. Fiddler2 reports no such errors.  Confused about this I started looking closely at my web.config and settings in my IIS6. I still haven't resolved those issues but I think I have a better understanding of what should be in web.config, so I thought I'd post a discussion on the topic here.  I hope this helps someone.

For anyone doing a search on this topic in the future, please correct any mis-information and provide links to solid resources on the topic. Again, it's important to ensure that someone can tell whether the information they see is only good for the current release, or if it applies to all releases.

2 Answers, 1 is accepted

Sort by
0
KDL
Top achievements
Rank 1
answered on 25 Feb 2010, 10:03 PM
I just want to add my .NET 4.0 findings to TonyG's excellent and thorough post (he deserves some Telerik points!):

Regarding that preCondition runtimeVersion2.0 spec, I'm thinking it doesn't need to be there. The documentation for that attribute says: "Specify the runtimeVersionv2.0 value when the handler should respond only to requests in application pools that are configured to use .NET Framework version 2.0.". I think this is a hold-over from when people were transitioning from v1.1 to 2.0. These days all application pools should be configured for .NET2.  The question becomes: what happens with .NET 3.x or .NET 4? Is it better to add that attribute parameter for the future, or to leave it out for the future?

I've found that IIS7 + .NET 4.0 + RadScriptManager will generate the following series of page errors:

  • Message: ASP.NET Ajax client-side framework failed to load.
  • Message: 'Sys' is undefined
  • Message: '$telerik' is undefined
  • Message: Object expected
  • Message: 'Sys' is undefined

    The page loads but no RadControls work, nor does anything that utilizes AJAX.

    I found two solutions to this:

    1. Use Microsoft ScriptManager rather than RadScriptManager.
    2. Remove "runtimeVersion2.0" from the preCondition attribute for at minimum the Telerik.Web.UI.WebResource.axd entry in the handlers section of system.webServer.

    I chose #2 above. I went ahead and removed this precondition from all Telerik entries in the system.webServer handlers section and haven't had any problems thus far.

    However, I suspect the whole issue is actually with RadCompression because when I removed the precondition from it's entry in the modules section, I had problems again. So by keeping the "runtimeVersion2.0" precondition on the RadCompression module, IIS7 doesn't use it for .Net 4 application pools.

    0
    Richard
    Top achievements
    Rank 2
    answered on 02 May 2010, 04:53 PM
    I just wanted to add a thanks for this imformation and confirm: I just updated from a "pure ASP.NET 3.5/Telerik/II7" system to "ASP.NET 4.0/Telerik/IIS7" and was getting the same errors noted above. Simply changing from:
    <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/&gt; 

    to

    &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/&gt; 

    solved the load problems. Does anyone know what side effects this may have?

    One other thing that is important is to update the IIS7 application pool integrated pipeline entry for your application to ASP.NET 4.0 (or use the classic)

    Thanks again!
    R
    Empire
    Top achievements
    Rank 1
    commented on 11 Feb 2020, 05:19 PM

    Thanks Richard. Removing that ",runtimeVersionv2.0" from preCondition worked for me as well.
    Tags
    General Discussions
    Asked by
    TonyG
    Top achievements
    Rank 1
    Answers by
    KDL
    Top achievements
    Rank 1
    Richard
    Top achievements
    Rank 2
    Share this question
    or