Will Page.ClientScript.GetWebResourceUrl work with Spark?
I'm working on converting NerdDinner to Spark and have everything except the mobile vie开发者_StackOverflow社区ws (which I'm not worrying about) and some code that uses Page. Here is one of the locations that is hanging up - but there are a couple of others due to the View not having a Page ...
In asp.net mvc the code looks like this:
<link rel="Stylesheet" type="text/css" href="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector.css")%>" />
The "Page.ClientScript.GetWebResourceUrl" call fails with an error about there not being a Page. Is this true?
I've worked around this one with adding an action that will return the resource as a FileStreamResult ... but there is another call using an open auth library that has a constraint check for a Page object ... so it fails due to the same problem - and unless I hack that code, I can't seem to find away around it. Is there anyway to get a Page in a Spark View?
In my project that uses Spark I am retrieving resources by use of a handler.
In reference to the other call, no there is no Page. A Page object is actually just a special HttpHandler that renders the markup to the response. So since MVC uses a different handler to create the Controller and render the View, there is no Page handler.
I would think the Open Auth library needs to be updated to work better with MVC.
精彩评论