1. 程式人生 > >Net4.0的網站在IE10、IE11出現“__doPostBack未定義”的解決辦法。

Net4.0的網站在IE10、IE11出現“__doPostBack未定義”的解決辦法。



方法一、瀏覽器設定成相容模式。

方法三、點選VS的工具選單--》庫程式包管理器--》程式包管理器控制檯(如果沒有“庫程式包管理器”的選單,就先點那個“擴充套件管理器”,安裝一個叫“NuGet程式包管理器”,然後就會有了。),點選後下面會出現一個連線PowerShell的控制檯,等控制檯載入完畢後輸入

              install-package App_BrowsersUpdate  回車

               等待安裝完成後,網站根目錄下面會出現一個App_BrowsersUpdate目錄。然後再訪問就不會出現“__doPostBack未定義”的錯誤提示了。

以上的方法三解決不了IE11

在NET4.0下出現“__doPostBack未定義”的辦法。

IE11的解決方法是(下面方法二選一):

二、在上面方法三生成的App_Browsers\ie.browser新增以下文字,在頂部的<browsers>下面:

[html] view plaincopyprint?在CODE上檢視程式碼片派生到我的程式碼片
  1. <browserid="IE11"parentID="Mozilla">
  2.   <identification>
  3.     <userAgentmatch="Trident\/7.0; rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)?)(?'letters'\w*))(?'extra'[^)]*)"
    />
  4.     <userAgentnonMatch="IEMobile"/>
  5.   </identification>
  6.   <capture>
  7.     <userAgentmatch="Trident/(?'layoutVersion'\d+)"/>
  8.   </capture>
  9.   <capabilities>
  10.     <capabilityname="browser"value="IE"/>
  11.     <capabilityname="layoutEngine"value="Trident"/>
  12.     <capability
    name="layoutEngineVersion"value="${layoutVersion}"/>
  13.     <capabilityname="extra"value="${extra}"/>
  14.     <capabilityname="isColor"value="true"/>
  15.     <capabilityname="letters"value="${letters}"/>
  16.     <capabilityname="majorversion"value="${major}"/>
  17.     <capabilityname="minorversion"value="${minor}"/>
  18.     <capabilityname="screenBitDepth"value="8"/>
  19.     <capabilityname="type"value="IE${major}"/>
  20.     <capabilityname="version"value="${version}"/>
  21.   </capabilities>
  22. </browser>
  23. <!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->
  24. <browserid="IE110"parentID="IE11">
  25.   <identification>
  26.     <capabilityname="majorversion"match="11"/>
  27.   </identification>
  28.   <capabilities>
  29.     <capabilityname="ecmascriptversion"value="3.0"/>
  30.     <capabilityname="jscriptversion"value="5.6"/>
  31.     <capabilityname="javascript"value="true"/>
  32.     <capabilityname="javascriptversion"value="1.5"/>
  33.     <capabilityname="msdomversion"value="${majorversion}.${minorversion}"/>
  34.     <capabilityname="w3cdomversion"value="1.0"/>
  35.     <capabilityname="ExchangeOmaSupported"value="true"/>
  36.     <capabilityname="activexcontrols"value="true"/>
  37.     <capabilityname="backgroundsounds"value="true"/>
  38.     <capabilityname="cookies"value="true"/>
  39.     <capabilityname="frames"value="true"/>
  40.     <capabilityname="javaapplets"value="true"/>
  41.     <capabilityname="supportsCallback"value="true"/>
  42.     <capabilityname="supportsFileUpload"value="true"/>
  43.     <capabilityname="supportsMultilineTextBoxDisplay"value="true"/>
  44.     <capabilityname="supportsMaintainScrollPositionOnPostback"value="true"/>
  45.     <capabilityname="supportsVCard"value="true"/>
  46.     <capabilityname="supportsXmlHttp"value="true"/>
  47.     <capabilityname="tables"value="true"/>
  48.     <capabilityname="supportsAccessKeyAttribute"value="true"/>
  49.     <capabilityname="tagwriter"value="System.Web.UI.HtmlTextWriter"/>
  50.     <capabilityname="vbscript"value="true"/>
  51.   </capabilities>
  52. </browser>
  <browser id="IE11" parentID="Mozilla">
    <identification>
      <userAgent match="Trident\/7.0; rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)?)(?'letters'\w*))(?'extra'[^)]*)" />
      <userAgent nonMatch="IEMobile" />
    </identification>
    <capture>
      <userAgent match="Trident/(?'layoutVersion'\d+)" />
    </capture>
    <capabilities>
      <capability name="browser"              value="IE" />
      <capability name="layoutEngine"         value="Trident" />
      <capability name="layoutEngineVersion"  value="${layoutVersion}" />
      <capability name="extra"                value="${extra}" />
      <capability name="isColor"              value="true" />
      <capability name="letters"              value="${letters}" />
      <capability name="majorversion"         value="${major}" />
      <capability name="minorversion"         value="${minor}" />
      <capability name="screenBitDepth"       value="8" />
      <capability name="type"                 value="IE${major}" />
      <capability name="version"              value="${version}" />
    </capabilities>
  </browser>
  <!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->
  <browser id="IE110" parentID="IE11">
    <identification>
      <capability name="majorversion" match="11" />
    </identification>

    <capabilities>
      <capability name="ecmascriptversion"    value="3.0" />
      <capability name="jscriptversion"       value="5.6" />
      <capability name="javascript"           value="true" />
      <capability name="javascriptversion"    value="1.5" />
      <capability name="msdomversion"         value="${majorversion}.${minorversion}" />
      <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" />
    </capabilities>
  </browser>