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 = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.js",
    DebugPath = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.debug.js",
    CdnPath = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.js",
    CdnDebugPath = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.debug.js
  });

ScriptManager.ScriptResourceMapping.AddDefinition(
  "MicrosoftAjaxWebForms.js",
  null, 
  new ScriptResourceDefinition 
  { 
    ResourceName = "MicrosoftAjaxWebForms.js",
    ResourceAssembly = typeof(ScriptManager).Assembly,
    Path = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.js",
    DebugPath = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.debug.js",
    CdnPath = "http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjaxWebForms.js",
    CdnDebugPath = "http://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=" http://www.wlmessenger.net/MicrosoftAjax/0911/MicrosoftAjax.js" />

    <asp:ScriptReference
      Name="MicrosoftAjaxWebForms.js"
      Path="http://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 (5)

  1. Harsha Patil says:

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

  2. Bill Forney says:

    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?

  3. Alejandro Hidalgo says:

    I found one issue,

    SCRIPT5022: Sys.InvalidOperationException: Invalid attribute 'sys:attach', the type 'wlsignin' is not a registered namespace.

    MicrosoftAjax.debug.js, line 9224 character 29

    In Internet Explorer 9 with your solution. Any idea?

  4. 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

  5. shahid says:

    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

Skip to main content