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.
- Remove the HttpModule from web.config
- Assure ScriptResource is not compressed: <scriptResourceHandler enableCompression=”false” enableCaching=”true” />
- Open the IIS Manager
- Right click on “Web Sites” folder > Properties
- Click the “Services” tab
- Check “Compress application files” and “Compress static files”
- Apply and confirm all dialogs
- Stop IIS
- Open a command prompt and go to C:\Inetpub\AdminScripts
- 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”
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.
CarloQuote 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