admin管理员组文章数量:1391989
I'm having a problem implementing the new Messenger Connect functionality inside an existing Sitefinity site to enable client logins using Live IDs.
Namely, when I'm using the following code to implement the client-side functionality:
<head runat="server">
<script type="text/javascript" src=".1/loader.js"></script>
</head>
<body>
<form runat="server" id="form1">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<wl:app
client-id="<%= ConfigurationManager.AppSettings["wl_wrap_client_id"] %>"
scope="WL_Profiles.View"
callback-url="<%= ConfigurationManager.AppSettings["wl_wrap_client_callback"] %>?wl_session_id=<%=SessionId %>"
channel-url="/channel.htm">
</wl:app>
... I get three errors in Firebug that I can't quite identify correctly:
Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys.IDisposable'. Parameter name: object
(in ScriptResource.axd?d=.... line 4993)
Sys.Application._doInitialize is not a function
(in MicrosoftAjaxBase.js line 1)
Sys.InvalidOperationException: The script 'MicrosoftAjaxGlobalization.js' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.
(in ScriptResource.axd?d=.... line 984)
The errors are only triggered when I include the loader.js
script from js.live.
EDIT: Seems the errors aren't necessarily triggered in that order. Refreshing the page seems to shuffle those errors and/or introduce other ones, such as a Sys.ParameterCountException
in ScriptResource.axd?...
on line 1842, for example.
I'm having a problem implementing the new Messenger Connect functionality inside an existing Sitefinity site to enable client logins using Live IDs.
Namely, when I'm using the following code to implement the client-side functionality:
<head runat="server">
<script type="text/javascript" src="http://js.live/4.1/loader.js"></script>
</head>
<body>
<form runat="server" id="form1">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<wl:app
client-id="<%= ConfigurationManager.AppSettings["wl_wrap_client_id"] %>"
scope="WL_Profiles.View"
callback-url="<%= ConfigurationManager.AppSettings["wl_wrap_client_callback"] %>?wl_session_id=<%=SessionId %>"
channel-url="/channel.htm">
</wl:app>
... I get three errors in Firebug that I can't quite identify correctly:
Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys.IDisposable'. Parameter name: object
(in ScriptResource.axd?d=.... line 4993)
Sys.Application._doInitialize is not a function
(in MicrosoftAjaxBase.js line 1)
Sys.InvalidOperationException: The script 'MicrosoftAjaxGlobalization.js' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.
(in ScriptResource.axd?d=.... line 984)
The errors are only triggered when I include the loader.js
script from js.live.
EDIT: Seems the errors aren't necessarily triggered in that order. Refreshing the page seems to shuffle those errors and/or introduce other ones, such as a Sys.ParameterCountException
in ScriptResource.axd?...
on line 1842, for example.
- I've had this error as well and haven't had any luck finding a solution yet. It seems that Messenger Connect uses its own version of the AJAX loader functionality and doesn't play nice with the existing version if you use it for other things (like async loading everything else). – Bill Forney Commented Mar 14, 2011 at 5:10
- See if this helps as well regardless of the originating culprit to see if it helps: stackoverflow./questions/19103128/… – atconway Commented Oct 3, 2013 at 17:32
1 Answer
Reset to default 3 +50Hey, I tried some binations here, and the one that worked was:
1) Set the ScriptMode property of the ScriptManager to Release;
2) Load the MSN library in the CodeBehind Page_Load event, using the ClientScript class:
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptInclude(this.GetType(), "live", "http://js.live/4.0/loader.js");
}
Firebug isn't showing any error anymore, and in my case, the authentication window is opening as desired.
Hope it helps!
EDIT
As told before, here follows the whole code I use to avoid this issue:
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/1999/xhtml" xmlns:wl="http://apis.live/js/2010">
<head>
<title>SignIn Example</title>
<script type="text/javascript">
function appLoaded(appLoadedEventArgs) {
}
function signInCallback(signInCompletedEventArgs) {
if (signInCompletedEventArgs.get_resultCode() === Microsoft.Live.AsyncResultCode.success)
{
alert('Sign-in successful.');
}
else
{
alert('Sign-in failed.');
}
}
</script>
</head>
<body>
<form runat="server" id="form1">
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release"></asp:ScriptManager>
<wl:app channel-url="http://labs.asteria..br/wlm/Channel.html"
callback-url="http://labs.asteria..br/wlm/Callback.aspx?wl_session_id=<%= Session.SessionID %>"
client-id="0000000044052209"
scope="WL_Profiles.View"
onload="{{appLoaded}}">
</wl:app>
<wl:signin
id="signInControl"
signedintext="Signed in. Click to sign out."
signedouttext="Click to sign in."
onsignin="{{signInCallback}}" />
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptInclude(this.GetType(), "live", "http://js.live/4.0/loader.js");
}
}
Web.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="wl_wrap_client_secret" value="[YOUR SECRET KEY]"/>
<add key="wl_wrap_client_id" value="0000000044052209"/>
<add key="wl_wrap_client_callback" value="http://labs.asteria..br/wlm/Callback.aspx"/>
</appSettings>
<connectionStrings/>
<system.web>
<customErrors mode="Off"/>
<pilation debug="true" targetFramework="4.0"></pilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>
To see it running, you can access http://labs.asteria..br/wlm. It seems that the Consent URL (https://consent.live./AccessToken.aspx) is not responding at this time.
本文标签: Javascript error when using Messenger Connect clientside library in ASPNETStack Overflow
版权声明:本文标题:Javascript error when using Messenger Connect client-side library in ASP.NET - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744651551a2617715.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论