Dynamic error in asp.net mvc 3.0 razor

I'm trying to add the code 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' does not have an applicable method called "OpenIdSelector", but there seems to be an extension method by that name. Extension methods cannot be dynamically sent. Consider casting dynamic arguments or calling an extension method without the extension method syntax.

I have no idea what he wants.

Edit

I get it now

CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for "OpenIdSelector" and the best overload of the extension method is "DotNetOpenAuth.Mvc.OpenIdHelper.OpenIdSelector (System.Web.Mvc.HtmlHelper, Titles DotNetOpenAutRet.utpen.outpen.outpen.outpen.outpen.tpen.outpen.outpen.outpen.utpen.outpen.utpen.utpen.utpen.utpen.utpen.utpen.outpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.outpenitoutpter.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.utpen.tpen ) "has some invalid arguments

Edit 2

They must have changed it. I checked and my version of dotnetopenauth does not accept 2 parameters, only 1.

The Nerd lunch option is 2.

Anyway, now I deleted it and got it

Server error in application "/". the current IHttpHandler is not one of the types: System.Web.UI.Page, DotNetOpenAuth.IEmbeddedResourceRetrieval. The embedded resource URL provider must be installed in the .config file.

+4
source share
2 answers

OpenIdSelector defined as an extension method, and you do not need to pass 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 a second change to your question, it looks like this might help: InvalidOperationException thrown by DotNetOpenAuth.IEmbeddedResourceRetrieval with Razor view

+7
source

The Page property is dynamic, and therefore the OpenIdSelector method cannot be dispatched with a dynamic property. Try using the Page property:

 @Html.OpenIdSelector((Page)this.Page, new SelectorButton[] { ... }); 
+1
source

Source: https://habr.com/ru/post/1336869/


All Articles