Best place to set CurrentCulture for multilingual ASP.NET MVC web applications

后端 未结 5 1804
死守一世寂寞
死守一世寂寞 2020-11-28 07:22

For multilingual ASP.NET MVC 3 web application, I am determining the Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture

5条回答
  •  半阙折子戏
    2020-11-28 08:07

    If you don't use ControllerActivator, can use BaseController class and inhеrid from it.

    public class BaseController : Controller
    {
        public BaseController()
        {
              //Set CurrentCulture and CurrentUICulture of the thread
        }
    }
    

    public class HomeController: BaseController    
    {
        [HttpGet]
        public ActionResult Index()
        {
            //..............................................
        }
    }
    

提交回复
热议问题