Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...CurrentCulture lost inside Http HandlerCurrentCulture lost inside Http Handler
Previous
 
Next
New Post
2/20/2008 12:52 PM
 

Hi,

I have an http handler in my dnn website (which serves redirections).

The trouble is that if for instance the current displayed page is in fr-FR culture, entering my handler the CurrentCulture is always en-US (default portal locale).

Why do the current culture is not correctly set before or preserved? Do I miss something ?

Thank you for the helpful reply

Thierry

 

 

 
New Post
2/20/2008 7:54 PM
 

what code are using to access the culture, is it System.Globalization.CultureInfo.CurrentCulture? We do some switching of values under the cover in dotnetnuke, so you may want to look at one of these, depending on your use case

-The users preferred value is stored in User.Profile.PreferredLocale .

-the nase page PageBase has a PageCulture method shows the logic of culture handling in dotnetnuke

-the language value get's (eventually) stored in a cookie, you may find it simpler to extract that (the cookie's called "language")

Cathal


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
2/21/2008 4:13 AM
 

Hi,

My scenario is the following:  I have a website with two languages, en-Us and fr-FR. When I click on my link (http handler) I want to redirect to the relevant page link (page name actually), in order to do so I use the Globals.NavigateUrl methods that creates my page url.

The point is that this method throw an null pointer exception in Localization.vb line 922 (in GetCurrentLocales() portalSettings are null). So I decided to set the portal settings in the context before calling NavigateUrl and this method always returns a url string to default locale (System.Globalization.CultureInfo.CurrentCulture is always en-US).

So: why at this time the portalSettings are null in the context ? Why NavigateUrl if I have prevously set the settings always returns  the page url for en-US and not fr-FR ?

Do I must set the entire context in my http handler and get the current locale in the cookie or somewhere else ? Yet System.Globalization.CultureINfo.CurrentCulture is good inside modules code even if the language parameter is not set in the url.

Thanks for your light on this (issue?)

Thierry

 

 
New Post
2/24/2008 6:18 PM
 

Portalsettings are null if there is no current httpcontext available. You can force a httpcontext to be available, and even force httphandler's to have a user context (see http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryID/436/Default.aspx for an example via a schedule task). If all you need to do is a urlrewrite I'd suggest it's easiest to get the value from the cookie.


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
9/9/2009 5:52 AM
 

Hi,

Issue is that when request comes to HTTP Handler --> ProcessRequest() method, Response.cookie collection contains "language" with value "en-US" which overwrites the value of language" cookie created by page and we lost the culture.

To resolve this, write below code in ProcessRequest() method

 if(Response.Cookies["language"] != null)
   {
      Response.Cookies.Remove("language");
  }

Thanks,
Ruchir

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...CurrentCulture lost inside Http HandlerCurrentCulture lost inside Http Handler


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out