lunedì 4 novembre 2013

Compatibilità IE 11 con .Net 4.0, ajaxcontroltoolkit 4.0

Da qualche giorno, dopo aver installato IE 11, le mie applicazione basate su asp.net 4.0 e ajaxcontroltoolkit , hanno smesso di funzionare.
Il problema nasce poichè ajaxcontroltoolkit non riconosce il browser impedendo ai updatepanel di fare CrossPostBack.
Per risolvere questo problema, in attesa di aggiornare i server al framework 4.5 ho trovato una scorciatoia.
Basta aggiungere al nostro progetto un file BrowserFile.browser ed aggiungere il seguente codice:

<browsers> 
 
<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>
  
</browsers>
 
 
Copiamo il file compilato sul server e tutto ritornerà a funzionare.