问题
I have website that has some issue to work with. One of the issues is loading 5x.
I have been trying to set language speficic for the page. My problem is as follows:
While page is refreshing n times it does somewhere overrides page language settings. I had as test modified global.asax page in Application_Start method. This method gets called only once. After this page goes into default.aspx page and hits the page ntimes, when the page gets initialised it change culture to default culture en-GB instead to the one I have set in Page_Load event.
I have set the thread . current . UI and Culture to my specific culture. But this does't work.
I have tried:
- Set language in global.asax
- Set language in global.asax + onload page for my default.aspx
- Use session to set language and after reload the page to display in correct page.
Any ideas?
回答1:
If you add this to Global.asax.cs it should work. It works for me.
protected void Application_BeginRequest(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-ch");
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("de-ch");
}
But your description of the issue is a bit confusing...
来源:https://stackoverflow.com/questions/13054270/setting-up-culture-to-aspx-website