在Global.asax文件中设置
private readonly IAbpWebLocalizationConfiguration _webLocalizationConfiguration; public MvcApplication() { _webLocalizationConfiguration = new AbpWebLocalizationConfiguration(); } protected override void Application_Start(object sender, EventArgs e) { AbpBootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>( f => f.UseAbpLog4Net().WithConfig(Server.MapPath("log4net.config")) ); base.Application_Start(sender, e); } protected override void Application_BeginRequest(object sender, EventArgs e) { if (this.Context.Request.Cookies[_webLocalizationConfiguration.CookieName]==null) { this.Context.Response.SetCookie( new HttpCookie(_webLocalizationConfiguration.CookieName, "ja") { Expires = Clock.Now.AddYears(2), Path = this.Context.Request.ApplicationPath } ); } }