it:ad:asp.net:mvc:views:partials:home

IT:AD:ASP.NET:MVC:Views:Partials

Not too bright – when it searches for a View, it looks here:

~/Views/BankWorkInstruction01/_BankWorkInstruction01DEView.aspx
~/Views/BankWorkInstruction01/_BankWorkInstruction01DEView.ascx
~/Views/Shared/_BankWorkInstruction01DEView.aspx
~/Views/Shared/_BankWorkInstruction01DEView.ascx
~/Views/BankWorkInstruction01/_BankWorkInstruction01DEView.cshtml
~/Views/BankWorkInstruction01/_BankWorkInstruction01DEView.vbhtml
~/Views/Shared/_BankWorkInstruction01DEView.cshtml
~/Views/Shared/_BankWorkInstruction01DEView.vbhtml

Modify Where it Searches

public class CustomViewEngine : WebFormViewEngine
{
  public CustomViewEngine()
  {
    var viewLocations =  new[] {  
        "~/Views/{1}/{0}.aspx",  
        "~/Views/{1}/{0}.ascx",  
        "~/Views/Shared/{0}.aspx",  
        "~/Views/Shared/{0}.ascx",  
        "~/AnotherPath/Views/{0}.ascx"
        // etc
    };

    this.PartialViewLocationFormats = viewLocations;
    this.ViewLocationFormats = viewLocations;
  }
}

And then register it:

protected void Application_Start()
{
    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(new CustomViewEngine());
}
You can go further: [http://stackoverflow.com/questions/909794/how-to-change-default-view-location-scheme-in-asp-net-mvc](http://stackoverflow.com/questions/909794/how-to-change-default-view-location-scheme-in-asp-net-mvc)
  • /home/skysigal/public_html/data/pages/it/ad/asp.net/mvc/views/partials/home.txt
  • Last modified: 2023/11/04 23:25
  • by 127.0.0.1