I have a razor snippet stored in a string:
@if (Request.IsAuthenticated)
{
<h1>Hello World</h1>
}
I store the code snippet in my cache. How can I inject the string such that it renders as if it was part of the original view file, executing the code also?
I have tried:
@ApplicationCache.GetDynamicString("MyString")
@Html.Raw(ApplicationCache.GetDynamicString("MyString"))
These methods return a string, not an MvcHtmlString. I could dynamically write to a partial view from my server and render the partial view, but I'm wondering if there's a helper I'm missing.