Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Affordable ASP.NET Hosting Service
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
r2i.ntegrated
 


  Sponsors  

Meet Our Sponsors

Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
ExactTarget email software solutions
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Localize It! (L...  CurrentCulture lost inside Http Handler
Previous Previous
 
Next Next
New Post 2/20/2008 8:52 AM
User is offline thierry
3 posts
10th Ranked


CurrentCulture lost inside Http Handler 

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 3:54 PM
User is offline cathal connolly
2375 posts
www.cathal.co.uk
5th Ranked










Re: CurrentCulture lost inside Http Handler 

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

 
New Post 2/21/2008 12:13 AM
User is offline thierry
3 posts
10th Ranked


Re: CurrentCulture lost inside Http Handler 

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 2:18 PM
User is offline cathal connolly
2375 posts
www.cathal.co.uk
5th Ranked










Re: CurrentCulture lost inside Http Handler 

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.

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Localize It! (L...  CurrentCulture lost inside Http Handler
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


The Standard in Senior Housing Information
SNAPforSeniors provides consumers with free online resources to assist them with their search for senior housing
www.snapforseniors.com
DotNetNuke Web Hosting w/ ASP.NET 3.5
Unlimited email boxes, Unlimited databases, Unlimited domains. Plans start at $4.97
www.MyWinHosting.com
SteadyRain
Founded in 1999, SteadyRain has extensive experience delivering Internet technology strategies and solutions for a diverse client base, ranging from Fortune 500 firms to successful start-ups.
www.steadyrain.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP