Compatibility problems with Internet Explorer 10/11 and an old .net framework 1.1 website

£可爱£侵袭症+ 提交于 2019-12-10 09:47:33

问题


The Scenario

I have a very old website developed in .net (framework 1.1). The site has several problems with Internet Explorer 10/11 that can be fixed using compatibility view.

The Problem

Problem is that framework 1.1 doesn't recognize Internet Explorer 10/11 as an advanced capability browser, so a lot of features (for example javascript code) are disabled when a user with Internet Explorer 10/11 accesses the website.

Microsoft released patches to fix this problem for .net framework versions >=2.0 but not for framework 1.1.

What I already tried

  1. I tried forcing IE7 Compatibility Mode in web.config or adding HTTP Header in IIS or directly inside html pages with:

    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    

    but this is not a valid solution, since javascript code is still missing due to the 1.1 framework issue.

  2. The only working solution I found is manually setting Compatibility View in the browser, but some of my customers have problems activating Compatibility View since they don't have confidence with PCs.

My two cents

I know that probably the best solution would be to convert the entire project to a newer version of the framework (>=2.0), unfortunately the project is huge and its conversion would be very complex (the solution includes a lot of other projects, older classic ASP sections, Crystal Reports reports and so on...)

The real question

Is there a solution that doesn't require project conversion or manual operations from end user?


回答1:


edit the web.config file and in the <system.web> section add

    <browserCaps>
        <case match="IE[ /](?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
            browser=IE
            version=${version}
            majorversion=${major}
            minorversion=${minor}
            frames=true
            tables=true
            cookies=true
            javascript=true
    javaapplets=true
            activexcontrols=true
            ecmascriptversion=1.5
            vbscript=true
            backgroundsounds=true
            isMobileDevice="true"
            <filter match="[4-9]" with="${major}">
                ecmascriptversion=1.3
                css1=true
                css2=true
                xml=true
                <filter match="[5-9]" with="${major}">
                    w3cdomversion=1.0
                </filter>
              </filter>
              <filter match="^b" with="${letters}">
               beta=true
            </filter>                                                               
         </case></browserCaps>



回答2:


First: The X-UA-Compatible tag has to be the very first tag in the < head > section.

Try using the emulate option, which allows quirks mode:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Also, completely removing a "DOCTYPE" from your page has also been known to help force compatibility mode or putting something like an xml declaration at the top

<?xml version="1.0" encoding="UTF-8">



回答3:


just try to configure the IIS for this -

Add the custom HTTP response header in IIS

To add a custom HTTP response header at the Web site level, at the folder level, or at the virtual directory level in IIS, follow the steps for the version of IIS that you are using.

IIS 7 on a Windows Server 2008-based Web server

  1. Start IIS Manager. To do this, click Start, click Run, type inetmgr, and then click OK.
  2. Under Connections, double-click the server that you want, and then double-click Sites.
  3. Click the Web site, the folder, or the virtual directory where you want to add the custom HTTP response header.
  4. Under Home, double-click HTTP Response Headers in the IIS section. Note The placeholder refers to the name of the Web site.
  5. Under Actions, click Add.
  6. In the Name box, type X-UA-Compatible.
  7. In the Value box, type IE=EmulateIE7.
  8. Click OK.

IIS 6 and earlier versions

  1. Click Start, click Run, type inetmgr.exe in the Open box, and then click OK.
  2. Expand the server that you want, and then expand Web Sites.
  3. Right-click the Web site, the folder, or the virtual directory that you want, and then click Properties.
  4. On the HTTP Headers tab, click Add under Custom HTTP headers.
  5. In the Custom header name box, type X-UA-Compatible.
  6. In the Custom header valuebox, type IE=EmulateIE7.
  7. Click OK two times.

for more detail please see this link




回答4:


I managed to find a solution: basically I retarget my application to run under Framework 4.0 while the application is still compiled with Framework 1.1.

To accomplish this I followed this MSDN page. Here's an excerpt:

You can retarget the application to run under .NET Framework 4. Retargeting requires that you add a element to the application's configuration file that allows it to run under .NET Framework 4. Such a configuration file takes the following form:

<configuration> 
   <startup>
      <supportedRuntime version="v4.0"/>
   </startup>
</configuration>

So my problem is solved in 2 steps:

  1. add this section to the web.config file of the Framework 1.1 web application:

    <configuration> 
       <startup>
          <supportedRuntime version="v4.0"/>
       </startup>
    </configuration>
    
  2. in IIS create a new application Pool and configure the old Framework 1.1 web application to run with Framework 4.0 in the newly created pool

Now the application runs under Framework 4.0 therefore new browsers are correctly recognized and advanced features are available.



来源:https://stackoverflow.com/questions/17302050/compatibility-problems-with-internet-explorer-10-11-and-an-old-net-framework-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!