1
votes

The scenario

I have an ASP.NET website that works perfectly in Internet explorer 8, but is extremely slow in Internet Explorer 10.

The Problem

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.

What I already tried

1.Installed a hotfix from Microsoft's website to update the browser definition files (http://support.microsoft.com/kb/2836939)

  1. I tried forcing IE8 and IE9 Compatibility Mode in web.config or adding HTTP Header in IIS or directly inside html pages.

  2. Tried changing the application pool in ISS on the server(Windows server 2008 R2).

  3. Installing .NET framework 4.0 on client machine

The Real question

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.)?

1
What do the performance tools with IE tell you is the slow bit?Rowland Shaw
Are you using an Update Panel in your code?Dash
@ Dash..Sorry forgot to mention, I also tried removing the update panels but still having the slow response time. I thought AJAX tools might be the problem. @Rowland the debugger is showing a very large viewsate and the time consuming part in the network traffic capturing is the POST Thanks for the quick response guys.Graaf
No need to remove the update panels. Try applying the solution. I hope it will be helpful.Dash

1 Answers

0
votes

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>