Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Internationalization / February 2005

Tip: Looking for answers? Try searching our database.

Question about currentCulture class.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Poonam - 16 Feb 2005 21:15 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.