如何获得“书呆子晚餐”? OpenID 弹出窗口工作
所以我尝试使用 NerdDinner 2 作为示例来实现 OpenID。当您单击其中一个 OpenID 提供商时,您会看到一个弹出窗口,如下图所示。我已经正确设置了大部分底层代码,并且我的登录页面加载并显示了三个提供程序按钮,但是当我单击它们时,没有弹出窗口。它根本没有任何作用。没有 JS 错误,只是什么也没发生。我缺少什么?
我已经查看了 NerdDinner 代码,但我无法准确找出导致弹出窗口发生的原因。我不一定需要有人告诉我我的应用程序出了什么问题,我只需要知道我在 NerdDinner 应用程序中寻找什么导致了这种情况发生,这样我就可以将它与我的应用程序进行比较。
我使用以下代码来呈现按钮:
@model dynamic
@using DotNetOpenAuth.Mvc;
@using DotNetOpenAuth.OpenId.RelyingParty;
<div id="login-oauth">
<fieldset>
<legend>via 3rd Party (recommended)</legend>
@using (Html.BeginForm("LogOnPostAssertion", "Auth"))
{
@Html.Hidden("ReturnUrl", Request.QueryString["ReturnUrl"], new { id = "ReturnUrl" })
@Html.Hidden("openid_openidAuthData")
<div>
@MvcHtmlString.Create(Html.OpenIdSelector(new SelectorButton[] {
new SelectorProviderButton("https://me.yahoo.com/", Url.Content("~/Content/images/yahoo.gif")),
new SelectorProviderButton("https://www.google.com/accounts/o8/id", Url.Content("~/Content/images/google.gif")),
new SelectorOpenIdButton(Url.Content("~/Content/images/openid.gif")),
}))
<div class="helpDoc">
<p>
If you have logged in previously, click the same button you did last time!!
</p>
</div>
</div>
}
</fieldset>
</div>
@{
var options = new OpenIdSelector();
options.TextBox.LogOnText = "Log On";
}
@MvcHtmlString.Create(Html.OpenIdSelectorScripts(options, null))
编辑:这种情况发生在所有浏览器中,并且没有弹出窗口阻止程序。
So I'm trying to implement OpenID using NerdDinner 2 as an example. When you click on one of the OpenID providers, you get a popup window that looks like the screenshot below. I've got most of the underlying code setup correctly and my login page loads and displays the three provider buttons, but when I click on them, there's no popup. It doesn't do anything at all. No JS errors, just nothing happens. What am I missing?
I've looked through the NerdDinner code but I'm having trouble trying to figure out exactly what causes the popup to occur. I don't necessarily need someone to tell me what's wrong with my app, I just need to know what I'm looking for in the NerdDinner app that causes it to happen so I can compare it with mine.
I'm using the following code to render the buttons:
@model dynamic
@using DotNetOpenAuth.Mvc;
@using DotNetOpenAuth.OpenId.RelyingParty;
<div id="login-oauth">
<fieldset>
<legend>via 3rd Party (recommended)</legend>
@using (Html.BeginForm("LogOnPostAssertion", "Auth"))
{
@Html.Hidden("ReturnUrl", Request.QueryString["ReturnUrl"], new { id = "ReturnUrl" })
@Html.Hidden("openid_openidAuthData")
<div>
@MvcHtmlString.Create(Html.OpenIdSelector(new SelectorButton[] {
new SelectorProviderButton("https://me.yahoo.com/", Url.Content("~/Content/images/yahoo.gif")),
new SelectorProviderButton("https://www.google.com/accounts/o8/id", Url.Content("~/Content/images/google.gif")),
new SelectorOpenIdButton(Url.Content("~/Content/images/openid.gif")),
}))
<div class="helpDoc">
<p>
If you have logged in previously, click the same button you did last time!!
</p>
</div>
</div>
}
</fieldset>
</div>
@{
var options = new OpenIdSelector();
options.TextBox.LogOnText = "Log On";
}
@MvcHtmlString.Create(Html.OpenIdSelectorScripts(options, null))
EDIT: This happens in all browsers and there are no popup blockers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因,将 global.asax.cs 中的以下路由从: 更改
为:
似乎已经解决了问题。不知道为什么,但使用 Firebug 查看请求显示尝试访问此路由时出现 500 错误。
For some reason, changing the following route in global.asax.cs from:
to:
Seems to have fixed the problem. No idea why, but looking at the requests with Firebug showed a 500 error attempting to access this route.