473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

CultureInfo getting hacked during page load.

OS: WIndows Server 2003.
Currently logged in user is running with German(German) regional settings.

Code fragment:
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("de-DE")
string name= culture.Name; // Produces "de-DE"
string s = (3.5).ToString(culture); // produces "3.5". Should produce "3,5"
string t = (new System.DateTime()).ToString("T",culture); // produces "2/16/2004". Should produce "16.2.2004"

If the currently logged in user is running with English(US) regional settings, the problem does not occur. This problem occurs for both locally and remotely connected HHTP settings.

What seems to be happening is that the regional settings for the CultureInfo corresponging to the default locale for the currently logged on user seems to get patched with en-US NumericFormat and DateFormat settings for the duration of OnInit and OnLoad. I can understand why somebody might want to do this. Problem is, that I have a validating date control that needs to convert posted values to native DateTimes. When I try to do

System.DateTime newDate =
System.DateTime.Parse(text)

in the postback handler, it failes, because it tries to parse the strings using the current CultureInfo, which has been mysteriously patched with en-US values. I'm helpless. There doesn't appear to be a way to get CultureInfo for "de-DE" that hasn't been hacked

If the logged in users' regional settings are changed to en-US (or, in fact, anything other the de-DE), everything works fine

Page generation works fine. By the time we get around to generating HTML, the correct format strings have been patched back in again

During postback handling, even

System.DateTime.Parse(text,new System.Globalalization.CultureInfo("de-DE"))

fails, because the Culture info returned includes the patches to the format patterns.

What's annoying is that I'm running with the right CultureInfo (Name="en-US") during page construction; and I even seem to be running with the right CultureInfo (Name="de-DE") during parameter postback.

Is there a way to disable this behaviour in ASP.NET?

I've tried explicitly setting the culture in the page. Doesn't help

Nov 18 '05 #1
1 1891
Hi,

I got the same problem with hebrew. changing the cultute attribute in
globalization tag at the web.config solved the problems for me.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Doc | last post by:
I keep reading about various websites being hacked into and wonder, how is this done? Not for any nefarious reasons, but to take measures to protect mine. Apparently this has been done to some high...
5
by: N | last post by:
Hi, I got an error during load on a couple of the tables. And it seems to be complaining that I'm running out of tempspace (possibly during index rebuild). Below is the load command and error....
2
by: Duwayne | last post by:
I am having lots of trouble with one of my user controls (ascx) not automatically loading postback data. An image on the aspx page starts the postback and the parent has no problem loading it's own...
1
by: John Cosmas | last post by:
I've got a page which loads up a different user control into a placeholder control every time a button is clicked on the parent page. I use a statement like...
2
by: Boonaap | last post by:
Hi all, In a user control, the user can put the cultureinfo to his preference, choosing between "nl-BE","fr-BE", and "en-US". this way all calendar and datetime properties are set in the right...
2
by: Chad | last post by:
In our application, I would like to send out HTML mail. TO do so, I must do something like this: Mail.Body = <raw HTMLTEXT String> Hence, I would like to know how to get the HTML text for Web...
4
by: John A Grandy | last post by:
what's the full class hierarchy for the CultureInfo object in effect by default ?
5
by: Jason L James | last post by:
Hi have two subroutines that change the currentCulture property of my application. I can call either: System.Threading.Thread.CurrentThread.CurrentCulture = New CultureInfo("en-GB") or:
8
by: Phil Jollans | last post by:
Hi, I am having difficulty overriding the ToString() method of CultureInfo using Visual Studio 2005. Exactly the same code works fine with Visual Studio .NET 2003. What I am doing is adding...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.