Change lookup rule for views

前端 未结 1 1014
粉色の甜心
粉色の甜心 2020-12-22 03:29

I have an application that gets rolled out in multiple countries. There will be a setting in the web.config file, that defines the country. The country will not be in the UR

相关标签:
1条回答
  • 2020-12-22 03:36
    public class MyViewEngine : WebFormViewEngine
    {
        private static string[] LocalViewFormats = new[] { "~/Views/ESP/{0}.aspx",
                                                              "~/Views/ESP/{0}.ascx" };
        public MyViewEngine()
        {
            ViewLocationFormats = LocalViewFormats.Union(ViewLocationFormats).ToArray();
        }
    }
    

    Obviously, you don't want to hardcode the location, but this should give you the general idea.

    0 讨论(0)
提交回复
热议问题