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:
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:
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:
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:
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:
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:
In this case the PublicKeyToken is required. More information on the topic is available here:
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.