What would be the recommended way to get at ServiceStack.Web.IRequest
from a ASP.NET Core Razor Partial View that is nested?
Placing @inherits ViewPage<T>
or @inherits ViewPage
at the top of the Partial Views seems to work except for one caveat, but not sure if it is the recommended way.
The one caveat of @inherits ViewPage<T>
or ViewPage
is that we cannot html inline @Request
. e.g. <p>@Request.SomeMethod()</p>
. A CompilationFailedException
error occurs.
Instead we need to define a variable up top in the @{ }
and set it and then use that variable in the html.
Note: I see that we can get to Context.Request
and Html.ViewContext.HttpContext.Request
from the View Partial.