IE10 sending image button click coordinates with decimals (floating point values) causing a ParseInt32 FormatException IE10 sending image button click coordinates with decimals (floating point values) causing a ParseInt32 FormatException asp.net asp.net

IE10 sending image button click coordinates with decimals (floating point values) causing a ParseInt32 FormatException


There are hotfixes for .NET CLR 2.0 and 4.0, as described in this blog entry by Scott Hanselmann:

What the fixes do is update the ie.browser and firefox.browser files in \Windows\Microsoft.NET\Framework\<version>\Config\Browsers with new and future-proofed versions of these browser definitions. Nothing else is affected.

.NET 4

.NET 2.0

Alternatively, there's a client-based javascript patch (originally posted as workaround on the Connect item with bug ID:755419):

$(function () {    // Patch fractional .x, .y form parameters for IE10.    if (typeof (Sys) !== 'undefined' && Sys.Browser.agent === Sys.Browser.InternetExplorer && Sys.Browser.version === 10) {        Sys.WebForms.PageRequestManager.getInstance()._onFormElementActive = function Sys$WebForms$PageRequestManager$_onFormElementActive(element, offsetX, offsetY) {            if (element.disabled) {                return;            }            this._activeElement = element;            this._postBackSettings = this._getPostBackSettings(element, element.name);            if (element.name) {                var tagName = element.tagName.toUpperCase();                if (tagName === 'INPUT') {                    var type = element.type;                    if (type === 'submit') {                        this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value);                    }                    else if (type === 'image') {                        this._additionalInput = encodeURIComponent(element.name) + '.x=' + Math.floor(offsetX) + '&' + encodeURIComponent(element.name) + '.y=' + Math.floor(offsetY);                    }                }                else if ((tagName === 'BUTTON') && (element.name.length !== 0) && (element.type === 'submit')) {                    this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value);                }            }        };    }});


Simply installing .NET Framework 4.5 can fix this problem.

This can fix the problem even if you do not switch your application pool over to .NET Framework 4.5.

In my case, I left the app pools at .NET Framework 3.5. Apparently installing .NET Framework 4.5 overwrites some files for other framework versions.

Since it is so easy to install the new .NET Framework version, it's probably worth a try before bothering with the hotfixes (which did not work for me) or other solutions.

See the workarounds section here


Here's a JavaScript workaround. It overrides the existing method, floors the x and y coordinates then calls the existing method with these new coordinates.

Sys.WebForms.PageRequestManager.getInstance()._origOnFormActiveElement = Sys.WebForms.PageRequestManager.getInstance()._onFormElementActive;Sys.WebForms.PageRequestManager.getInstance()._onFormElementActive = function(element, offsetX, offsetY){    if (element.tagName.toUpperCase() === 'INPUT' && element.type === 'image'){        offsetX = Math.floor(offsetX);        offsetY = Math.floor(offsetY);    }    this._origOnFormActiveElement(element, offsetX, offsetY);};