Resolving a conflict with ASP.NET Ajax Extensions

Sites that are using ASP.NET 3.5 or ASP.NET 4.0 Ajax Extensions (The ScriptManager, UpdatePanel and other controls) may run into a conflict when using version 3.7 of the Windows Live Messenger Web Toolkit. The conflict occurs because ASP.NET Ajax Extensions use a built-in version of Microsoft Ajax runtime which is older than the one used by the Messenger Web Toolkit. The conflict is visible as a script error that is thrown from the Microsoft Ajax JavaScript files that are loaded by the Messenger Web Toolkit.

There is a workaround that is possible for version 3.7 and continuing versions of the Messenger Web Toolkit. When a web application is using Messenger Web Toolkit and needs to use the ASP.NET Ajax Extensions (either version 3.5 or 4.0), the following steps can be taken:

For applications using ASP.NET 4.0 Ajax Extensions:

1. Add the following declarations to the Application_Start method in Global.asax:

ScriptManager.ScriptResourceMapping.AddDefinition(
  "MicrosoftAjax.js",
  null,
  new ScriptResourceDefinition
  {
    ResourceName = "MicrosoftAjax.js",
    ResourceAssembly = typeof(ScriptManager).Assembly,
    Path = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.js",
    DebugPath = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.debug.js",
    CdnPath = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.js",
    CdnDebugPath = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.debug.js"
  });

ScriptManager.ScriptResourceMapping.AddDefinition(
  "MicrosoftAjaxWebForms.js",
  null,
  new ScriptResourceDefinition
  {
    ResourceName = "MicrosoftAjaxWebForms.js",
    ResourceAssembly = typeof(ScriptManager).Assembly,
    Path = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.js",
    DebugPath = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.debug.js",
    CdnPath = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.js",
    CdnDebugPath = "https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.debug.js"
  }); 

2. Make sure that the <script> tag that loads the Messenger Web Toolkit loader occurs after the <scriptmanager> tag in the page.

For applications using ASP.NET 3.5 Ajax Extensions:

1. Change the <scriptmanager> tag to the following:

<asp:ScriptManager ID="ScriptManager1" runat="server">
  <scripts>
    <asp:ScriptReference
      Name="MicrosoftAjax.js"
      Path=" https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.js" />

    <asp:ScriptReference
      Name="MicrosoftAjaxWebForms.js"
      Path="https://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.js" />
  </scripts>
</asp:ScriptManager>

2. Make sure that the <script> tag that loads the Messenger Web Toolkit loader occurs after the <scriptmanager> tag in the page.

 

Offir Bakshitz
Software Design Engineer
Windows Live Messenger Platform Team