Uncategorized

The message received from the server could not be parsed

Again on the Ajax-compression subject (see here and here), here’s another error I got recently:



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.


The customer was using the GZipStream class within an HttpModule to compress the ASP.NET output; everything was working except in pages where he was using some UpdatePanel controls, where he was getting error messages like the above. As you can guess if you’ve read my previous posts, with http compression the response stream was being truncated.


There are a couple of solutions available to this error: do not use the HttpModule and rely on IIS compression, or move the application to the .NET Framework 3.5.



  1. Remove the HttpModule from web.config

  2. Assure ScriptResource is not compressed: <scriptResourceHandler enableCompression=”false” enableCaching=”true” />

  3. Open the IIS Manager

  4. Right click on “Web Sites” folder > Properties

  5. Click the “Services” tab

  6. Check “Compress application files” and “Compress static files”

  7. Apply and confirm all dialogs

  8. Stop IIS

  9. Open a command prompt and go to C:\Inetpub\AdminScripts

  10. Run the following commands to add .js, .aspx and .axd to the compression list:


    • cscript adsutil.vbs set W3SVC/Filters/Compression/GZIP/HcFileExtensions “htm” “html” “txt” “js”

    • cscript adsutil.vbs set W3SVC/Filters/Compression/Deflate/HcFileExtensions “htm” “html” “txt” “js”

    • cscript adsutil.vbs set W3SVC/Filters/Compression/GZIP/HcScriptFileExtensions “asp” “dll” “exe” “aspx”

    • cscript adsutil.vbs set W3SVC/Filters/Compression/Deflate/HcScriptFileExtensions “asp” “dll” “exe” “aspx”

  11. Restart IIS

You can also move the application to .NET Framework 3.5 instead, because the UpdatePanel control has been changed internally and now this problem should not happen anymore.


 


Carlo

Quote of the day:
There are painters who transform the sun to a yellow spot, but there are others who with the help of their art and their intelligence, transform a yellow spot into the sun. – Pablo Picasso

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.