Dear ACT experts,
I upgraded a fairly large and complex ASP.NET application from .NET Framework 3.5 to 4.0. I also upgraded AjaxControlToolKit to the suggested one for .NET Framework 4.0 (4.1.7.1213). Unfortunately UpdatePanel control seems to be broken now, as the upgraded
version is not updating the client side HTML after a change; client side js processing fails with 2 different JS errors instead.
On server side, the UpdatePanel is set to ChildrenAsTriggers="true", so I expect an ajax postback on any content control change.
I've done the following inspection so far with IE Dev Tools (We are using IE8):
There are 2 cases:
A) Accessing the application with localhost url.
B) Accessing the application with fully qualified machinename. In this case, request and response goes through a proxy chain (which should also work).
Behavior is slightly different in both cases.
Case A
Response is seemingly OK (compared to the 3.5 version), but client side js fails with the following error:
Webpage error details
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; .NET4.0C; .NET4.0E; MS-RTC LM 8; Unicredit)
Timestamp: Thu, 17 Jul 2014 14:04:45 UTC
Message: Sys.InvalidOperationException: Could not find UpdatePanel with ID ''. If it is being updated dynamically then it must be inside another UpdatePanel.
Line: 940
Char: 13
Code: 0
URI:
http://....../ScriptResource.axd?d=JGIMCka_B5hCdOL4f5noKcijd_067NQh-TVAcdr5nOkoUF17sUEEEQiID6euG8T-0_WwgPLUKTcFEg5c-UK-W66PDOyWG6OglkaKleiolJ6NG1NmahW-8_a8KDZnMM5vWLT1vTpg2WfithU4PIjXjPKHBqU1&t=51e37521
(this scriptresource.axd call points to MicrosoftAjaxWebForms.debug.js (4.1.7.1213)). This error message is fairly misleading as it complains about some nested UpdatePanel (which I don't have any), and the reality is that it fails at trying to iterate through
the enlisted UpdatePanel content (of which there are 8, but really there are only 4, but the code seems to ignore the even ones if it goes with version4). See the for cycle in _onFormSubmitCompleted method at line 1433 in MicrosoftAjaxWebForms.debug.js (4.1.7.1213).
I was curious, and in this case I've tried to amend the response with the following string on the start: "1|#||4|", because somehow it seems to expect something like this, and it fixed the client side operation, the script updated the HTML properly! My problem
is, that I don't know how to put this string at the start of the response automatically (neither I think that it'd be my task...).
Case B
Response starts with the ominous "4|#||4|" (which is bad, as the first number should show that how long the content of this part must be), but compared to case A, important parts are missing too. This case, the MicrosoftAjaxWebForms.debug.js (4.1.7.1213)
throws error at _parseDelta line 1554, because
if (reply.charAt(replyIndex) !== '|') {
at line 1543 returns false and it fills the parserErrorDetails (hence, call to _endPostBack with error and return null).
Additional information: important part of web.config is the following:
<?xml version="1.0" encoding="UTF-8"?><configuration><system.web.extensions><scripting><webServices><jsonSerialization maxJsonLength="5000000" /></webServices><scriptResourceHandler enableCompression="false" enableCaching="true" /></scripting></system.web.extensions><system.web><machineKey validationKey="..." decryptionKey="..." validation="SHA1" decryption="AES" /><compilation defaultLanguage="c#" debug="true"/><customErrors mode="Off" /><authentication mode="Forms"><forms loginUrl="Logon.aspx?Redirect=true" name="adAuthCookie" timeout="60" path="/" /></authentication><authorization><deny users="?" /><allow users="*" /><!-- Allow all users --><!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/><deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
--></authorization><trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /><sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="120" /><globalization requestEncoding="utf-8" responseEncoding="utf-8" /><pages clientIDMode="AutoID"><controls><add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add tagPrefix="act" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" /></controls></pages><httpHandlers><remove verb="*" path="*.asmx" /><remove verb="*" path="*_AppService.axd" /><remove verb="GET,HEAD" path="ScriptResource.axd" /><add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></httpHandlers><healthMonitoring><rules><add name="Application Lifetime Events Default" eventName="Application Lifetime Events" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /><add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /></rules></healthMonitoring></system.web><appSettings><add key="aspnet:MaxHttpCollectionKeys" value="2000" /></appSettings><system.webServer><httpProtocol><customHeaders><clear /><add name="X-UA-Compatible" value="IE=EmulateIE7" /></customHeaders></httpProtocol><validation validateIntegratedModeConfiguration="false" /><modules><remove name="ScriptModule" /><add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></modules><handlers><remove name="WebServiceHandlerFactory-Integrated" /><remove name="ScriptHandlerFactory" /><remove name="ScriptHandlerFactoryAppServices" /><remove name="ScriptResource" /><add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></handlers><urlCompression doStaticCompression="true" doDynamicCompression="true" /></system.webServer><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" /><bindingRedirect oldVersion="3.0.0.0-4.0.0.0" newVersion="4.1.7.1213" /></dependentAssembly></assemblyBinding></runtime></configuration>
Case A response header:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/plain; charset=utf-8
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-UA-Compatible: IE=EmulateIE7
Date: Thu, 17 Jul 2014 14:03:12 GMT
Content-Length: 186227
Case B response header:
HTTP/1.0 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 151464
Content-Type: text/plain; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-UA-Compatible: IE=EmulateIE7
Date: Thu, 17 Jul 2014 14:07:37 GMT
X-Cache: MISS from x.x.x.x
X-Cache-Lookup: MISS from x.x.x.x:8080
X-Cache: MISS from drop20
X-Cache-Lookup: MISS from y:8080
Via: 1.0 y.x.x.x (squid/3.1.10)
Connection: keep-alive
Things that I've tried and not worked:
- code inspection for Response.Write, Response.Redirect, Server.Transfer (none of them used during the client-server roundtrip)
- various web.config pimps for handlers/modules
- turn IIS compression off
- remove httpModules from web.config
- downgrade AjaxControlToolkit to some older version (3.5, 3.0)
Any ideas?
K