I’ve been trying for days (really, days) to use “external” files (provided from a different server using an ashx handler) as layouts in Razor.
@{
Layout = "http://someServer/templates.ashx?path=/my/template.cshtml";
}
This gives me an error about the path having to be a virtual one.
I’ve tried everything I could think of: VirtualPathProviders, custom RazorViewEngines, etc.
Nothing helps, has anyone done this or can someone give me a hint?
Make a
VirtualPathProviderthat handles virtual paths that start with a magic token and passes all other paths to itsPreviousproperty.For example: