I am creating a protected module. Here is the structure of the files under _protected:
Web.config is the common one as in usual MVC application for views to be able to work properly.
Then I have a controller in which I am explicitly setting view path using a virtual path to the "modules/_protected" which is "~/cms/":
public class CustomerController : Controller
public ActionResult Index()
// Doesn't work
With this configuration I get such error:
When I change the path to the file structure (~/modules/_protected/Customer/Views/Customer/Index.cshtml) then a view is resolved correctly.
Is there any configuration needed to make Razor views work with virtual paths?
Also, is there any configuration available to enable Razor views in the module ViewEngine? Now it seems that only WebForm views are resolved.
I've reported this before as a bug, but the developer team have decided this is a feature request. CMS-1506 or CMS-3891, note that they're not in the public bug list.
I wrote an article on how to setup Razor views for Episerver modules: http://marisks.net/2017/03/05/configuring-razor-view-support-for-episerver-modules/
© Episerver 2017 |
About Episerver World