在 ASP.NET 中使用 Messenger Connect 客户端库时出现 Javascript 错误
我在现有 Sitefinity 站点内实现新的 Messenger Connect 功能以启用客户端使用 Live ID 登录时遇到问题。
也就是说,当我使用以下代码来实现客户端功能时:
<head runat="server">
<script type="text/javascript" src="http://js.live.net/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>
...我在 Firebug 中收到三个错误,但我无法正确识别:
Sys.ArgumentTypeException:“Sys._Application”类型的对象不能 转换为类型“Sys.IDisposable”。 参数名称:对象
(在 ScriptResource.axd?d=.... 第 4993 行)
Sys.Application._doInitialize 不是 功能
(在 MicrosoftAjaxBase.js 第 1 行中)
Sys.InvalidOperationException: 脚本“MicrosoftAjaxGlobalization.js” 已被多次引用。如果 引用 Microsoft AJAX 脚本 显式设置 MicrosoftAjaxMode ScriptManager 的属性 明确。
(在 ScriptResource.axd?d=.... 第 984 行)
仅当我包含来自 js.live.net 的 loader.js
脚本时才会触发错误。
编辑:似乎错误不一定按该顺序触发。刷新页面似乎会重新排列这些错误和/或引入其他错误,例如第 1842 行的 ScriptResource.axd?... 中的 Sys.ParameterCountException 。
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.net/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.net.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嘿,我在这里尝试了一些组合,有效的组合是:
1)将 ScriptManager 的 ScriptMode 属性设置为 Release;
2) 使用 ClientScript 类在 CodeBehind Page_Load 事件中加载 MSN 库:
Firebug 不再显示任何错误,在我的情况下,身份验证窗口将根据需要打开。
希望有帮助!
编辑
如前所述,下面是我用来避免此问题的整个代码:
Default.aspx
Default.aspx.cs
Web.config
如果看到它正在运行,您可以访问 http://labs.asteria.com.br/wlm。同意 URL (https://consent.live.com/AccessToken.aspx) 此时似乎没有响应。
Hey, I tried some combinations 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:
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
Default.aspx.cs
Web.config
To see it running, you can access http://labs.asteria.com.br/wlm. It seems that the Consent URL (https://consent.live.com/AccessToken.aspx) is not responding at this time.