Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CrossPostback ,AJAX Controls and ASP.NET generated postbacks work for .NET 4.5 , not .NET 4.0 in IE 11

I had posted and answered the question earlier.WebResource.axd not working with Internet Explorer 11
But I thought the hotfix had fixed the issue(CrossPostback ,AJAX Controls and ASP.NET generated postbacks not working) but after installing in QA , it didn't work and we realized it was .NET 4.5 that made things work .
I am under the process of comparing .NET frameworks folder between .NET 4 and .NET 4.5. What I needed to ask what could in .NET 4.5 really resolve the IE 11 issue.
The major change in IE 11 is the user agent string. What particular fix in .NET 4.5 could have resolved the differences between ASP.NET 4.0 and IE 11.
Manually merging the differences might not really help as in future if a security/hot fix gets installed in .NET 4.0 , these files might get overwritten.
Another headsup , the issue is for IE 11 in Windows 7,8,8.1 Any help or suggestions.
UPDATE : We tried registering only the browser definitions of .NET 4.5 into .NET 4.0 but still the issue remains so apart from the definitions there are some libraries that make things work in IE 11.

like image 367
Rameez Ahmed Sayad Avatar asked Aug 02 '13 05:08

Rameez Ahmed Sayad


2 Answers

We had a similar issue where the auto-postback for a DropDownList stopped working with newer versions of IE. We first noticed it with IE10 and tracked it to the browser definition bug many are aware of and which is detailed here, among other places.

For this particular application, and the set of boxes its different environments ran/runs on, upgrading to 4.5 wasn't a near-term option. What's more, the machine-wide fixes detailed in the post above errored-out when we tried to install it. The site-wide fix, however, did do the trick.

A week or two later, someone happened to hit the site with IE11 Preview, and there the issue was again. We did some more research and discovered that the browser definition "IE10Plus" from the site-wide fix - which did in fact fix the IE10 issue - wouldn't work for IE11. To identify IE10, a majorversion regex match was added - "\d{2,}" - which matched two digits (as opposed to the previous matches which were along the lines of "^9$" - matches exactly "9") and IE10 now worked. The problem is that the IE10Plus definition (and each IE definition before it) derived ultimately from the "IE" definition and that definition also required the UA string to have "MSIE" in it (among other things) and, as of IE11, "MSIE" is no longer part of the UA string.

"IE10Plus" should really be called "IE10".

Given that we couldn't in the near-term upgrade to 4.5, we had to find another solution. And the one we hit on was to create our own IE11 browser definition. We couldn't define any capabilities beyond what we saw in IE10, but that was pretty close and at least it would identify the browser (and not degrade the functionality, as was happening).

People will tell you not to do this, but for some (like us) it does provide a temporary fix until a final solution comes along.

I don't know in what way 4.5 is supposed to fix this. I've looked at the browser definition files and I don't see a way for them to identify IE11 (with no "MSIE" in its UA string), but maybe there is some additional fix buried in a DLL somewhere.

In any case, here's the definition we created and, for us, it solved the problem immediately.

In your project, add to (or create as) App_Browsers/ie.browser, the following:

<!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko -->
<browser id="IE11Preview" parentID="Mozilla">
    <identification>
        <userAgent match="Trident/(?'layoutVersion'\d+).*rv:(?'revision'(?'major'\d+)(\.(?'minor'\d+)?))" />
        <userAgent nonMatch="MSIE" />
    </identification>

    <capabilities>
        <capability name="browser"              value="IE" />
        <capability name="layoutEngine"         value="Trident" />
        <capability name="layoutEngineVersion"  value="${layoutVersion}" />
        <capability name="isColor"              value="true" />
        <capability name="screenBitDepth"       value="8" />
        <capability name="ecmascriptversion"    value="3.0" />
        <capability name="jscriptversion"       value="6.0" />
        <capability name="javascript"           value="true" />
        <capability name="javascriptversion"    value="1.5" />
        <capability name="w3cdomversion"        value="1.0" />
        <capability name="ExchangeOmaSupported" value="true" />
        <capability name="activexcontrols"      value="true" />
        <capability name="backgroundsounds"     value="true" />
        <capability name="cookies"              value="true" />
        <capability name="frames"               value="true" />
        <capability name="javaapplets"          value="true" />
        <capability name="supportsCallback"     value="true" />
        <capability name="supportsFileUpload"   value="true" />
        <capability name="supportsMultilineTextBoxDisplay" value="true" />
        <capability name="supportsMaintainScrollPositionOnPostback" value="true" />
         <capability name="supportsVCard"        value="true" />
        <capability name="supportsXmlHttp"      value="true" />
        <capability name="tables"               value="true" />
        <capability name="supportsAccessKeyAttribute"    value="true" />
        <capability name="tagwriter"            value="System.Web.UI.HtmlTextWriter" />
        <capability name="vbscript"             value="true" />
        <capability name="revmajor"             value="${major}" />
        <capability name="revminor"             value="${minor}" />
    </capabilities>
</browser>

If you're adding to an existing file, look for id="IE10Plus" - you may want to change that to id="IE10" as the "Plus" part is no longer accurate.

As I've said, if you can go to 4.5, and it fixes your issue - great. If you can't, or it doesn't, this might hold you until you can (or until some other fix comes along).

like image 176
Michael Avatar answered Oct 20 '22 20:10

Michael


hi try the following script It might help you.

<script type="text/javascript">
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);
};
</script>
like image 36
Appdev Avatar answered Oct 20 '22 21:10

Appdev