View Engine: define where to look for views with fallback
up vote
0
down vote
favorite
I set a theme in web.config, which means, that each customer can load different views for the same webshop.
In Application_Start I have:
RazorViewEngine viewEngine = new RazorViewEngine();
var theme = System.Configuration.ConfigurationManager.AppSettings["Themes"];
viewEngine.PartialViewLocationFormats =
viewEngine.ViewLocationFormats =
viewEngine.MasterLocationFormats =
new string
"~/Assets/Views/1/0.cshtml",
"~/Assets/Views/Shared/1/0.cshtml";
viewEngine.AreaMasterLocationFormats =
viewEngine.AreaPartialViewLocationFormats =
viewEngine.AreaViewLocationFormats =
new string
"~/Assets/Areas/2/Views/1/0.cshtml",
"~/Assets/Areas/2/Views/Shared/1/0.cshtml";
ViewEngines.Engines.Add(viewEngine);
This works, but how can I define a fallback if a view file is not found?
asp.net-mvc viewengine
add a comment |
up vote
0
down vote
favorite
I set a theme in web.config, which means, that each customer can load different views for the same webshop.
In Application_Start I have:
RazorViewEngine viewEngine = new RazorViewEngine();
var theme = System.Configuration.ConfigurationManager.AppSettings["Themes"];
viewEngine.PartialViewLocationFormats =
viewEngine.ViewLocationFormats =
viewEngine.MasterLocationFormats =
new string
"~/Assets/Views/1/0.cshtml",
"~/Assets/Views/Shared/1/0.cshtml";
viewEngine.AreaMasterLocationFormats =
viewEngine.AreaPartialViewLocationFormats =
viewEngine.AreaViewLocationFormats =
new string
"~/Assets/Areas/2/Views/1/0.cshtml",
"~/Assets/Areas/2/Views/Shared/1/0.cshtml";
ViewEngines.Engines.Add(viewEngine);
This works, but how can I define a fallback if a view file is not found?
asp.net-mvc viewengine
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I set a theme in web.config, which means, that each customer can load different views for the same webshop.
In Application_Start I have:
RazorViewEngine viewEngine = new RazorViewEngine();
var theme = System.Configuration.ConfigurationManager.AppSettings["Themes"];
viewEngine.PartialViewLocationFormats =
viewEngine.ViewLocationFormats =
viewEngine.MasterLocationFormats =
new string
"~/Assets/Views/1/0.cshtml",
"~/Assets/Views/Shared/1/0.cshtml";
viewEngine.AreaMasterLocationFormats =
viewEngine.AreaPartialViewLocationFormats =
viewEngine.AreaViewLocationFormats =
new string
"~/Assets/Areas/2/Views/1/0.cshtml",
"~/Assets/Areas/2/Views/Shared/1/0.cshtml";
ViewEngines.Engines.Add(viewEngine);
This works, but how can I define a fallback if a view file is not found?
asp.net-mvc viewengine
I set a theme in web.config, which means, that each customer can load different views for the same webshop.
In Application_Start I have:
RazorViewEngine viewEngine = new RazorViewEngine();
var theme = System.Configuration.ConfigurationManager.AppSettings["Themes"];
viewEngine.PartialViewLocationFormats =
viewEngine.ViewLocationFormats =
viewEngine.MasterLocationFormats =
new string
"~/Assets/Views/1/0.cshtml",
"~/Assets/Views/Shared/1/0.cshtml";
viewEngine.AreaMasterLocationFormats =
viewEngine.AreaPartialViewLocationFormats =
viewEngine.AreaViewLocationFormats =
new string
"~/Assets/Areas/2/Views/1/0.cshtml",
"~/Assets/Areas/2/Views/Shared/1/0.cshtml";
ViewEngines.Engines.Add(viewEngine);
This works, but how can I define a fallback if a view file is not found?
asp.net-mvc viewengine
asp.net-mvc viewengine
asked yesterday
WhoMightThisOneBe
1379
1379
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224243%2fview-engine-define-where-to-look-for-views-with-fallback%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password