We normally come through the below script error whenevr we use AJAX control toolkit dll (whatever version) and asp.net 3.5 along with IIS 7:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C)
Timestamp: Fri, 30 Jul 2010 09:58:16 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 PUB’.
Line: 938
Char: 13
Code: 0
URI: http://<your ip or site-domain>/ScriptResource.axd?d=ypee4bZreSXIBlo8NPlkI7935qFo_oPPGXfE6smUiS-G2Z0PoBt-AVShAb2YObDxD5ZYlJ8QyOQKZ4vhQ9mpGQ2&t=11e6618b

I can 100% confidently say that this is due to Response.Write or Response.End calls we have used at-least in any single page of the website that uses AJAX Update panels. If you have pages that dont use any update panels, you can of course use the Response calls without any issue.

Also, its sure that you can use Reponse.redirect without any problem inside AJAX UpdatePanels. Just make sure that you are using the second parameter of Response.redirect method and it should be set to FALSE. Otherwise you will get an error while debugging that ‘Property Evaluation Failed.’. This can be avoided by setting the Boolean value FALSE as the second parameter of the Response.Redirect method, so that all your code after this line will execute for sure. 

Instead of Response.Write statements inside AJAX Update panels use either ScriptManager.RegisterClientscriptblock or use  ScriptManager.RegisterStartUpscript. Instead of Response.End you can use Exit Sub or Exit Function (if its vb.net). make sure you return appropriate values while exiting from a function. Otherwise it will throw another error that ‘Not all code path returns values’

Always make sure you are always using the latest AJAX control toolkits as per .net framework. Microsoft updates the control toolkits periodically with patch-fixes. Watch out for that.

One thought on “ASP.net 3.5 + AJAX => Script error in ScriptResource.axd”

Leave a Reply