gpt4 book ai didi

c# - asp.net mvc 3.0 Razor 中的动态错误

转载 作者:太空狗 更新时间:2023-10-30 00:35:25 25 4
gpt4 key购买 nike

我正在尝试添加一些我从 nerdinner 获得的代码

  @Html.OpenIdSelector(this.Page, new SelectorButton[] 
{
new SelectorProviderButton("https://me.yahoo.com/", Url.Content("~/Content/Images/Account/Index/yahoo_64.png")),
new SelectorProviderButton("https://www.google.com/accounts/o8/id", Url.Content("~/Content/images/google.gif")),
new SelectorOpenIdButton(Url.Content("~/Content/images/openid.gif")),
})

但是我得到了这个错误

Error 1 'System.Web.Mvc.HtmlHelper' has no applicable method named 'OpenIdSelector' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

我不知道它想要什么。

编辑

我明白了

CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'OpenIdSelector' and the best extension method overload 'DotNetOpenAuth.Mvc.OpenIdHelper.OpenIdSelector(System.Web.Mvc.HtmlHelper, params DotNetOpenAuth.OpenId.RelyingParty.SelectorButton[])' has some invalid arguments

编辑2

他们一定已经改变了它。我正在检查,我的 dotnetopenauth 版本不接受 2 个参数,只有 1 个。

Nerd 晚餐版本需要 2 个。

无论如何,现在我删除了它并得到了它

Server Error in '/' Application. The current IHttpHandler is not one of types: System.Web.UI.Page, DotNetOpenAuth.IEmbeddedResourceRetrieval. An embedded resource URL provider must be set in your .config file.

最佳答案

OpenIdSelector 定义为扩展方法,您不必传入第一个参数。相反,您可以这样调用它:

@Html.OpenIdSelector(new SelectorButton[] {...})

这相当于下面的调用:

@OpenIdHelper.OpenIdSelector(this.Html, new SelectorButton[] {...})

对于您的问题的第二次编辑,看起来这可能会有所帮助:InvalidOperationException thrown regarding DotNetOpenAuth.IEmbeddedResourceRetrieval with Razor view

关于c# - asp.net mvc 3.0 Razor 中的动态错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4787518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com