This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14931|Reply: 0

[ASP.NET] ASP.NET MVC modifies the Shared default path of the view (MVC2, MVC3)

[Copy link]
Posted on 8/5/2016 10:49:02 AM | | | |


ASP.NET MVC2 modifies the default path of the view

Steps: 1. Write a class that inherits from WebFormViewEngine and rewrite the view path

2. Add a statement to Application_Start():

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new MvcViewEngine());





ASP.NET MVC3 modifies the default path of the view

Steps: 1. Write a class that inherits from RazorViewEngine and rewrite the view path

2. Add a statement to Application_Start():

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new MvcViewEngine());




Please note the difference between these two versions, MVC2's custom classes inherit from WebFormViewEngine, and MVC3's customized classes inherit from RazorViewEngine;

The suffix of the view file is also different, please pay more attention.





Previous:Html Agility Pack Download and How to Use It
Next:C# is prone to problems when passing multiple parameters in a loop multithread
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com