Question

What is the easiest way to create a Custom AreaViewEngine that S#arp uses?

I want to add another directory to search for view for the current tenant, the tenant directory would be part of the domain name (e.g. hm.com), so i would like my view engine to check:

/Tenants/hm.com/Views/Home/Index.aspx

I tried to create a new TenantViewEngine.cs inherited from the AreaViewEngine to add my new paths but I can't get access to the HttpContext to get the host name.

Any ideas?

Thanks. Paul

Was it helpful?

Solution

HttpContext.Current should be available. Also, ControllerContext passed as a parameter to Find* and Create* methods has a HttpContext property.

You might also want to look at the VirtualPathProviderViewEngine class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top