I am trying to add some code that I got from 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")),
})
however I get this error
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.
I have no clue what it wants.
Edit
I get this now
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
Edit 2
They must have changed it. I was checking and my version of dotnetopenauth does not take in 2 parameters only 1.
Nerd dinners version takes in 2.
Anyways now I removed that and get this
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
is defined as an extension method and you don't have to pass in the first parameter. Instead you call it like this:
@Html.OpenIdSelector(new SelectorButton[] {...})
This is equivalent to the following call:
@OpenIdHelper.OpenIdSelector(this.Html, new SelectorButton[] {...})
For the second Edit to your question, looks like this might help: InvalidOperationException thrown regarding DotNetOpenAuth.IEmbeddedResourceRetrieval with Razor view
The Page
property is dynamic, and as such the OpenIdSelector
method can't be despatched with a dynamic property. Try casting the Page
property:
@Html.OpenIdSelector((Page)this.Page, new SelectorButton[] { ... });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With