2/23/2025 10:57:58 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Initalize session variable from querystring
Posted: 16 Jun 08 9:42 AM
|
I want to initialize a session variable on the logon screen when a user is redirected there with a language parameter (ie. ...login.aspx?lang=de-DE). The page culture is then put into a session variable. The problem is that I need to refresh the page to get the culture to stick and have the localization take place on the login page. If I try to refesh the page in the onload event, it gets stuck in a loop of refreshment. I was doing this successfully with hyperlinks but the client would also like to be able to pass the language in the url.
I have this code in the page_onload of login.master: string sLang = Request.QueryString["lang"]; if (sLang != "") { Session["MyCulture"] = sLang; Server.Transfer(Request.Path); }
This is the code that needs to fire in the login.aspx: protected override void InitializeCulture() { //retrieve culture information from session string culture = Convert.ToString(Session["MyCulture"]);
//check whether a culture is stored in the session if (!string.IsNullOrEmpty(culture)) Culture = culture; else Culture = "en-US"; //else Culture = m_DefaultCulture;
//set culture to current thread Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture); Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
//call base class base.InitializeCulture(); }
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|