
Question:
<strong>The scenario</strong>
I have an ASP.NET website that works perfectly in Internet explorer 8, but is extremely slow in Internet Explorer 10.
<strong>The Problem</strong>
In Internet Explorer 8 a postback or button click event takes about 1,5 seconds to complete. In internet explorer 10 it takes a minimum of 30 seconds and sometimes over 60 seconds.
<strong>What I already tried</strong>
1.Installed a hotfix from Microsoft's website to update the browser definition files (<a href="http://support.microsoft.com/kb/2836939" rel="nofollow">http://support.microsoft.com/kb/2836939</a>)
<ol start="2"><li>I tried forcing IE8 and IE9 Compatibility Mode in web.config or adding HTTP Header in IIS or directly inside html pages.
</li> <li>Tried changing the application pool in ISS on the server(Windows server 2008 R2).
</li> <li>Installing .NET framework 4.0 on client machine
</li> </ol><strong>The Real question</strong>
Could ASP.NET still be having issues detecting Internet Explorer 10 as a browser, or could the slow response time between the browsers be a problem on the web server(browser definition files etc.)?
Answer1:When using Internet Explorer to browse a page that contains an UpdatePanel, there is a delay (often anywhere between 10 seconds and 45 seconds or more) after clicking a page element that initiates an async postback. The delay is not experienced when using browsers other than Internet Explorer.
The PageRequestManager's _destroyTree method iterates through the DOM elements inside of the UpdatePanel prior to initiating an async postback in order to dispose of DOM elements. The _destroyTree method's specific implementation is very slow in Internet Explorer when working with a large DOM tree under some conditions due to the way that Internet Explorer's HTML viewer (mshtml.dll) stores DOM elements in memory.
Add the JavaScript below immediately before the closing </body>
element of the page experiencing the delay.
<script language="javascript" type="text/javascript">
function disposeTree(sender, args) {
var elements = args.get_panelsUpdating();
for (var i = elements.length - 1; i >= 0; i--) {
var element = elements[i];
var allnodes = element.getElementsByTagName('*'),
length = allnodes.length;
var nodes = new Array(length)
for (var k = 0; k < length; k++) {
nodes[k] = allnodes[k];
}
for (var j = 0, l = nodes.length; j < l; j++) {
var node = nodes[j];
if (node.nodeType === 1) {
if (node.dispose && typeof (node.dispose) === "function") {
node.dispose();
}
else if (node.control && typeof (node.control.dispose) === "function") {
node.control.dispose();
}
var behaviors = node._behaviors;
if (behaviors) {
behaviors = Array.apply(null, behaviors);
for (var k = behaviors.length - 1; k >= 0; k--) {
behaviors[k].dispose();
}
}
}
}
element.innerHTML = "";
}
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(disposeTree);
</script>