Hi,
I am writing a .NET based web application which is localized also. I am
using Form Authentication and I use following code to transfer to the next
page:
FormsAuthentication.RedirectFromLoginPage(email, false);
Now on Session Start, I have following code:
protected void Session_Start(Object sender, EventArgs e)
{
// For each session request initialize the culture values with the
// user language as specified by url.
try
{
string culture = Request.Params.Get("lang");
if (culture == null)
{
culture = ConfigurationSettings.AppSettings["DefaultLanguage"];
}
try
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture
(culture);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
}
catch(Exception)
{
// provide fallback for not supported languages. This is really just a
safety catch,
//for 'in-case' scenarios
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
}
}
So my first page shows me the right content based on the language but as
soon as they are redirected to the next page after authentication, my culture
value is set back to "English US".
I really appreciate if you guys can help me.
Thanks
Poonam
JezB - 25 Feb 2005 17:35 GMT
I think you need to instantiate Culture and UICulture on every request,
rather than every session. You can do it in
Application_PreRequestHandlerExecute or Application_BeginRequest (but the
latter does not have Session available).
> Hi,
> I am writing a .NET based web application which is localized also. I am
[quoted text clipped - 41 lines]
> Thanks
> Poonam