Wednesday, January 5, 2011

Resolution of Telerik RadPanel error due to upgrade to .NET Framework 4.0

One of our ASP.NET applications developed a bug after upgrading to the .NET Framework 4.0.  We use a Telerik RadPanel for web site navigation and we discovered that an error would occur when clicking on any RadPanel element, but only when the user opened the site to the default URL without specifying a page.

Example:
http://mysite.com/  - produces the error
http://mysite.com/default.aspx  - no error occurs

Here is the error message:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.3; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET4.0C; .NET4.0E)
Timestamp: Wed, 29 Dec 2010 20:43:39 UTC
Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html P'.
Line: 6
Char: 84093
Code: 0
URI: http://mysite.com/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f68db6e-ab92-4c56-8744-13e09bf43565%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3af4b6e7a5-697d-4c2b-91aa-e1490df08c78%3a16e4e7cd%3af7645509%3aed16cbdc%3a24ee1bba%3a1e771326%3a4cacbc31

The solution is to add a "managedHandler" preCondition attribute to the Telerik RadCompression module in the web.config file, system.webserver/modules section.

  <system.webServer>
<
validation validateIntegratedModeConfiguration="false"/>
<
modules>
<
remove name="RadUploadModule"/>
<
add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode"/>
<
remove name="RadCompression"/>
<
add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode,managedHandler"/>
</
modules>
</system.webServer>


Here are links to the articles that describe the problem and solution, give more information on the "add" element, and provide a great explanation of IIS7 PreConditions.

No comments:

Post a Comment