Share via


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

Comments

  • Anonymous
    October 19, 2010
    Awesome, even though I already spent 5-6hrs troubleshooting this issue, you definitely saved my next 10s of hours.

  • Anonymous
    March 14, 2011
    Now that there is a newer release of this, what should the proper path to the AJAX library be? Is the Messenger Connect stuff still using an old beta version of the library?

  • Anonymous
    March 21, 2011
    The comment has been removed

  • Anonymous
    May 01, 2011
    Hello Offir Bakshitz, I am using ASP.NET 4.0. I have implemented the solution. I am able to see see Windows Live Signin button and it is working fine. But I am getting error in pages where I am using Response.Redirect. Error: A potentially dangerous Request.Path value was detected from the client (:). I have added <httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" /> in webconfig file . Now it is showing another file not found error! will there be any inbuilt solutions included in Windows Live ID SDK for this or we have to implement all these solutions? Regards, Damodar_K

  • Anonymous
    May 16, 2011
    I am still getting following error Microsoft JScript runtime error: Sys.InvalidOperationException: Operation is not valid due to the current state of the object. source file : MIcrosoftAjax.js