尝试导航到LogOn页面时,我不断收到此错误:
System.NullReferenceException:未将对象引用设置为对象的实例
抛出错误的代码行是:
<%= Html.OpenIdSelectorScripts(this, options, null)%>.
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么这行代码会抛出错误?
c# asp.net asp.net-mvc nullreferenceexception dotnetopenauth
我想添加一些我从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")),
})
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误
错误1'System.Web.Mvc.HtmlHelper'没有名为'OpenIdSelector'的适用方法,但似乎有一个名称的扩展方法.无法动态分派扩展方法.考虑转换动态参数或调用扩展方法而不使用扩展方法语法.
我不知道它想要什么.
编辑
我现在明白了
CS1928:'System.Web.Mvc.HtmlHelper'不包含'OpenIdSelector'的定义和最佳扩展方法重载'DotNetOpenAuth.Mvc.OpenIdHelper.OpenIdSelector(System.Web.Mvc.HtmlHelper,params DotNetOpenAuth.OpenId.RelyingParty. SelectorButton [])'有一些无效的参数
编辑2
他们肯定已经改变了.我正在检查,我的dotnetopenauth版本只接受2个参数1.
书呆子晚餐版本需要2.
无论如何,现在我删除了它并得到它
'/'应用程序中的服务器错误.当前的IHttpHandler不是以下类型之一:System.Web.UI.Page,DotNetOpenAuth.IEmbeddedResourceRetrieval.必须在.config文件中设置嵌入式资源URL提供程序.