I'm trying to use DotNetOpenAuth with Razor/MVC3. Most of DotNetOpenAuth HTML helpers are accepting System.Web.UI.Page as one of parameters, w开发者_运维技巧hich works fine standard using WebForms engine but does not with Razor. Is it possible to cast dynamic WebPageBase.Page into System.Web.UI.Page somehow?
Thanks, Antonin
System.Web.UI.Page is part of the Web Forms page model and is totally unrelated to Razor. A Razor page inherits from System.Web.WebPages.WebPage which isn't part of the same hierarchy. As GvS mentioned, the "Page" property is a different object in Razor. In Razor, that property is just a C# dynamic object that provides a shortcut for accessing PageData values. For example: PageData["foo"]
is the same as Page.foo
.
They are totally different objects. So, no, you cannot cast or convert into a System.Web.UI.Page.
But this article might help you further.
精彩评论