Hi Poonam,
Welcome to msdn newsgroup.
Yes, the problem you mentioned is quite normal, the ASP.NET is a web
application which is request/respsonse based. So when a certain request is
processed, that worker thread is terminated or back to the threadpool, and
the sequential comming request may belong to a different thread. So only set
cultureInfo once in Session_Start is not a possible solution. We need to
adjust the thread's culture everytime at the beginning(in begin request
event for example). Maybe you can store the culture info in cookie, or just
create the culture from the clientside's browser 's prefered userlanguages.
HTH
thanks.
Steven
[quoted text, click to view] "Poonam" <Poonam@discussions.microsoft.com> wrote in message
news:DEA2D929-DECF-45B6-ADDE-07BB6A2D5C58@microsoft.com...
> 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