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.



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

Comments (10)

  1. Raman says:

    Good Article.

    I have same error but in SharePoint Site. I have a webpart which uses AJAX. It communicate to Webservices and some other dlls. The webpart works fine when we install Web Services and Other dlls in same server(MOSS Server). I have tested my application with 2,3,and 4 server and application works fine. But I following 4 server setup throw error.

    I have 4 server environment,

    I have intalled component in following way:

    Server 1 – All dlls and Web Services 1

    Server 2 – Web Services 2 and Database

    Server 3 – Domain Server and Exchange server

    Server 4 – MOSS and Webpart

    With only this specific distributed environment my webpart causes this error.

    I have tried your approach but still I am getting the error.

  2. Raman, do you have any firewall/proxy between your servers? Anything which might remove/alter the HTTP headers or the web request? Here is a nice post on this erro:


  3. Lukos says:

    Hi Carlo,

    Interesting post. This is a very common problem cause by several things but I haven’t found an article yet that covers the whole issue in useful detail. I have the same problem with a page and have checked all the things that can cause the problem but it is not any of those. I pulled the text from Fiddle during the request and it certainly looks OK but it is hard to tell. Do you have any other advice?

  4. Neal F says:

    I got the same error, but it was only when I set "Display tracing information on individual pages".  As soon as I unchecked it, the problem went away.

    To uncheck it –

    Website -> ASP.NET configuration

    Application Tab, choose "Configure debugging and tracing", then deselect "Display tracing information on individual pages"

    Hope this helps…

  5. Colin says:

    Thanks for the post. I also got this error when using Ajax UpdatePanels. After some investigation, I found that the error was occuring due to me creating a Session variable on the Async postback. This, in turn, changed the Content Header which completely confused the Ajax UpdatePanel/Response.

    I simply created the Session variable when the page loaded, rather than when the postback occured, which solved the problem.

  6. Http compression with client-side scripting should be handled with care. The problem can have different

  7. Ajax is a flexible and powerful technology, but sometimes “ With great power comes great responsibility

  8. aru says:

    I am getting the above issue, when I opened in two browerser in different pcs. I applied ajax technique over grdview. when I select the combo box, based on the selection I am re-rendering the gridview. If i did like that I am getting the above error in other browser end.

    please help me if any one have idea. thanks.

  9. William Ramirez says:

    I have exactly the same problem with the gridview and the dropdownlist. This is the scenario: I change the index of the dropdown list and while the postback is happening i end the session (with the login status control) and use this code:

      Session.Item("sID") = Nothing






    Any suggestion will be appreciated. Thanks.

Skip to main content