You will need to create your own ViewEngineif you want to switch to viewing from a location other than the Views folders.
public class CustomViewEngine : WebFormViewEngine {
public CustomViewEngine() : base() {
MasterLocationFormats = new[] {
"/YourFolder/{1}/{0}.master",
"/YourFolder/Shared/{0}.master"
};
ViewLocationFormats = new[] {
"/YourFolder/{1}/{0}.aspx",
"/YourFolder/{1}/{0}.ascx",
"/YourFolder/Shared/{0}.aspx",
"/YourFolder/Shared/{0}.ascx"
};
PartialViewLocationFormats = ViewLocationFormats;
}
public override ViewEngineResult FindView(
ControllerContext controllerContext, string viewName,
string masterName, bool useCache)
return base.FindView(controllerContext, viewName, masterName, useCache);
}
}
Then register ViewEnginein Global.asax:
protected void Application_Start() {
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new CustomViewEngine());
}
, . ( , , )
. , , ASP.NET (. Eilon ).
, , .