473,385 Members | 1,912 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,385 software developers and data experts.

Regional Settings en-GB CultureInfo.CurrentCulture.Name = en-US

Hello,

I know I can set the Culture to what I want, but shouldn't the current
culture be taken from the regional settings on the web server's
control panel!!!

Mine is set to "united kingdom"

but in my asp.net page I do

string cl = CultureInfo.CurrentUICulture.Name;
string cn = CultureInfo.CurrentCulture.Name;

both string return en-US

I need this to be en-GB so my comparevalidator will do a date check on
a textbox....

Anyone else experience this?
Nov 18 '05 #1
12 9096
What is the Windows regional setting for the user context in which the
server-side code is executing? I'm guessing that it's not the same account
under which you're viewing the regional settings since the latter is
probably the administrator account.
"magister" <yu***@yahoo.co.uk> wrote in message
news:98**************************@posting.google.c om...
Hello,

I know I can set the Culture to what I want, but shouldn't the current
culture be taken from the regional settings on the web server's
control panel!!!

Mine is set to "united kingdom"

but in my asp.net page I do

string cl = CultureInfo.CurrentUICulture.Name;
string cn = CultureInfo.CurrentCulture.Name;

both string return en-US

I need this to be en-GB so my comparevalidator will do a date check on
a textbox....

Anyone else experience this?

Nov 18 '05 #2
On 8 Jul 2004 04:12:18 -0700, yu***@yahoo.co.uk (magister) wrote:
I know I can set the Culture to what I want, but shouldn't the current
culture be taken from the regional settings on the web server's
control panel!!!


I'm not sure exactly what you want, but what we do (in Page_Load()) in
our ASP.Net applications - which I believe will give the effect you
want - is this call to a routine we wrote specifically to enable easy
multi-language/multi-date-format/etc:

UIUtilities.setCulture(Request);

Where this is what gets called:

/// <summary>
/// Set the display culture for the current thread to the most
appropriate culture from the user's incoming Http "request" object.
/// </summary>
/// <param name="request"></param>
internal static void setCulture(HttpRequest request)
{
if (request != null)
{
if (request.UserLanguages != null)
{
if (request.UserLanguages.Length > -1)
{
string cultureName =
request.UserLanguages[0];
UIUtilities.setCulture(cultureName);
}
}
// TODO: Set to a (system-wide, or possibly
user-specified) default culture if the browser didn't give us any
clues.
}
}

/// <summary>
/// Set the display culture for the current thread to a particular
named culture.
/// </summary>
/// <param name="cultureName">The name of the culture to be set for
the thread</param>
private static void setCulture(string cultureName)
{
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(cultureName);
Thread.CurrentThread.CurrentUICulture = new
CultureInfo(cultureName);
}
What this does is that the thread that processes the output (and
input) for that user for the page is AUTOMATICALLY set for the
appropriate culture (eg for date input/output) for that user. It uses
a header which is sent automatically by the browser (4.0 and later -
works fine with Firefox/Mozilla too), so the user of your ASP.Net
application doesn't have to separately select a language/culture
preference in the application.

NB: You can change this setting for testing (in IE for example) by
going to Tools/Internet Options/Languages, then adding the language
you want to test and moving it to be the first/top one.

Because it is per-user, rather than being based on a server setting,
it is a lot more flexible as far as being "world-ready".

FWIW we use the same browser header to work in with the
ResourceManager mechanism to provide other-language text in the output
web pages too, simply by doing the following after the call to set the
thread culture to the right one for the user:

ResourceManager resourceManager = new
ResourceManager("AppName.strings", typeof(SampleForm).Assembly);

(then using ctrl.Text = resourceManager.GetString("NameOfItem") as
normal)

The net effect of all this is that a user who wants dates the "right
way" around (I'm an Australian) for output and input validation will
have the page work that way, and someone who prefers MM/DD/YYYY will
in turn have that work for their input/output WITHOUT you having to do
anything hardwired in your code, or forcing users to select a
language/culture preference for your app in their logon details.

ted.h.
--
Ted Harper (Sydney, Australia)
Nov 18 '05 #3
Where can I check&change the regional settings of my user account?
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:<O7**************@TK2MSFTNGP09.phx.gbl>...
What is the Windows regional setting for the user context in which the
server-side code is executing? I'm guessing that it's not the same account
under which you're viewing the regional settings since the latter is
probably the administrator account.
"magister" <yu***@yahoo.co.uk> wrote in message
news:98**************************@posting.google.c om...
Hello,

I know I can set the Culture to what I want, but shouldn't the current
culture be taken from the regional settings on the web server's
control panel!!!

Mine is set to "united kingdom"

but in my asp.net page I do

string cl = CultureInfo.CurrentUICulture.Name;
string cn = CultureInfo.CurrentCulture.Name;

both string return en-US

I need this to be en-GB so my comparevalidator will do a date check on
a textbox....

Anyone else experience this?

Nov 18 '05 #4
Depends which user account is being used. Unless you're impersonating a
custom user, chances are you'll need to manually edit the registry since you
probably won't be able to run the regional settings control panel for, say,
the ASPNET user unless you've been mucking with its password.

That said, I wouldn't recommend using this approach. It's a much better
idea to programmatically set the appropriate culture rather than relying on
the configuration of the web server or the runtime user context. Either of
these might be altered at any time to support some other application's
dependency. Also, you might find yourself needing to support the client
regional preferences, in which case programmatic setting is the only way to
go.

HTH,
Nicole
"magister" <yu***@yahoo.co.uk> wrote in message
news:98**************************@posting.google.c om...
Where can I check&change the regional settings of my user account?
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message
news:<O7**************@TK2MSFTNGP09.phx.gbl>...
What is the Windows regional setting for the user context in which the
server-side code is executing? I'm guessing that it's not the same
account
under which you're viewing the regional settings since the latter is
probably the administrator account.
"magister" <yu***@yahoo.co.uk> wrote in message
news:98**************************@posting.google.c om...
> Hello,
>
> I know I can set the Culture to what I want, but shouldn't the current
> culture be taken from the regional settings on the web server's
> control panel!!!
>
> Mine is set to "united kingdom"
>
> but in my asp.net page I do
>
> string cl = CultureInfo.CurrentUICulture.Name;
> string cn = CultureInfo.CurrentCulture.Name;
>
> both string return en-US
>
> I need this to be en-GB so my comparevalidator will do a date check on
> a textbox....
>
> Anyone else experience this?

Nov 18 '05 #5
On 9 Jul 2004 05:28:41 -0700, yu***@yahoo.co.uk (magister) wrote:
Where can I check&change the regional settings of my user account?


You (probably) don't want to change the regional settings of "your"
user account, or even the ASPNET account on the server, but rather you
want to change them on the _thread_ doing the work on the ASP.Net
server to the regional settings of the CALLING users.

I posted a larger code fragmenet for you to do this in my other post
in this thread (which may not have propagated to you yet), but here is
basically what you do in Page_Load():

string cultureName = request.UserLanguages[0];
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(cultureName);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(cultureName);

Once you have done that (up the top of Page_Load(),
DateTime.ToString() and DateTime.Parse() will operate with respect of
the culture settings of each calling user.

This operates using a standard browser header that is sent by 4.0 and
later browsers and indicates the language/culture preference of the
user. You can change the settings your browser sends for testing
purposes via Tools/Internet Options/Languages - add the language you
want and move it to the top/first position, then refresh the page you
are testing against (assuming it has implemented the logic above in
its Page_Load()), and you'll see the input/output formats change
appropriately.
ted.h.
--
Ted Harper (Sydney, Australia)
Nov 18 '05 #6
bb
hello, im experiencing exatly the same problem, and suspect the answer
is something along the lines of what someone has linked to this message.

im now trying to find out how and where to set the locale settings for
whomever is owning the iis process (LocalSystem)

magister wrote:
Hello,

I know I can set the Culture to what I want, but shouldn't the current
culture be taken from the regional settings on the web server's
control panel!!!

Mine is set to "united kingdom"

but in my asp.net page I do

string cl = CultureInfo.CurrentUICulture.Name;
string cn = CultureInfo.CurrentCulture.Name;

both string return en-US

I need this to be en-GB so my comparevalidator will do a date check on
a textbox....

Anyone else experience this?

--
------------------------
Think your smart?
Prove your programming power @ the OSI Geek Challenges
http://www.osix.net
------------------------
Nov 18 '05 #7
bb
magister wrote:
Hello,

I know I can set the Culture to what I want, but shouldn't the current
culture be taken from the regional settings on the web server's
control panel!!!

Mine is set to "united kingdom"

but in my asp.net page I do

string cl = CultureInfo.CurrentUICulture.Name;
string cn = CultureInfo.CurrentCulture.Name;

both string return en-US

I need this to be en-GB so my comparevalidator will do a date check on
a textbox....

Anyone else experience this?

Fixed this.

its something along the lines of this thread here ....
http://www.mcse.ms/message872783.html

i played around with what it suggested, but it didnt work, so instead, i
just looked through the HKEY_USERS registry entries looking at each's
control panel/international settings.

when i found one that had US rather than UK, i modified it, restarted
iis then requested my dummy page which outputs the locale.

eventually i found the right entry (which in my case was user S-1-5-20
which i guess corresponds with either the ASPNET user or the
IUSER_MACHINENAME account )

dont forget to restart iis after each change.


--
------------------------
Think your smart?
Prove your programming power @ the OSI Geek Challenges
http://www.osix.net
------------------------
Nov 18 '05 #8

Hi
Thank you for your site Resp.
And Happy New Year.
Bye
--
lindavids
------------------------------------------------------------------------
lindavids's Profile: http://www.hightechtalks.com/m517
View this thread: http://www.hightechtalks.com/t23260

Dec 30 '06 #9

Very Interesting
Thanks you for your work.
Best regards.
--
alexdixis
------------------------------------------------------------------------
alexdixis's Profile: http://www.hightechtalks.com/m520
View this thread: http://www.hightechtalks.com/t23260

Jan 1 '07 #10

Very Interesting
'stati uniti shopping'
(http://euro.initalyall.com/stati-uniti-shopping.html) stati uniti
shopping http://euro.initalyall.com/stati-uniti-shopping.html 'ricerca
domini' (http://euro.initalyall.com/ricerca-domini.html) ricerca domini
http://euro.initalyall.com/ricerca-domini.html

Best regards.
--
alinapush
------------------------------------------------------------------------
alinapush's Profile: http://www.hightechtalks.com/m521
View this thread: http://www.hightechtalks.com/t23260

Jan 2 '07 #11

Hi all!
The information is successfully classified. Reasonable structure of a
site.This is a great website! Real nice! Thanks much!
may be my site interesting for you ?
'fotocamera' (http://allitalysite.info/fotocamera.html) fotocamera

http://www.allitalysite.info
Bye
--
alenasverid
------------------------------------------------------------------------
alenasverid's Profile: http://www.hightechtalks.com/m530
View this thread: http://www.hightechtalks.com/t23260

Jan 5 '07 #12

Cool site. Thank you!!! legislation gambling internet Excellent design,
thanks for a site! You discuss very good subject. Very good web site,
great work and thank :) you for your service.
Maybe my site interesting to you <a
href=http://cas.romeupdate.info/portatile.html>portatile</a>
--
anukadevkizm
------------------------------------------------------------------------
anukadevkizm's Profile: http://www.hightechtalks.com/m535
View this thread: http://www.hightechtalks.com/t23260

Jan 5 '07 #13

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

Similar topics

1
by: nerman | last post by:
Hello I have a problem with the regional settings. I have set the regional settings of the web server to display the numbers in this format 123.456,78 But when I open my web site all number are...
3
by: JohnK | last post by:
doing some research on regional settings, .Net & DB I put my machine in Germany(Germany) thus the decimal char = "," the seperator char = "." so I set up the database for a test in .Net I'm...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
4
by: Jonathan | last post by:
Dear All, I am trying to set a webserver to use French regional settings for testing ASP pages. According to http://support.microsoft.com/kb/q306044, for IIS5, this is a matter of changing...
3
by: Andrew Poulos | last post by:
I'm updating a db in which I have a column of Date/Time data type. The regional settings here for short date are: day / month / full year eg. 28/4/2005 It's easy enough for me to build a string...
2
by: isaacrajan | last post by:
Hello, Is there a way in which users can be prevented from making changes to regional settings in Win XP Professional edition so that the interpretation of dates by an Access application remains...
3
by: Emmanuel | last post by:
I want to know the decimal separator and the group separator character that the user has set in Regional Settings in Control Panel. I tryied to use...
16
by: Colmag | last post by:
I've written an application with vb.net 2003 (framework 1.1) which automates a 3rd party viewing/printing application (via an activex control). I've released several versions over the last year...
0
by: mikepl746 | last post by:
I'm trying to run the svn command in a System.Diagnostics.Process to parse the StandardOutput. If I run the command in a CMD window while Regional settings are set to Japanese I see something like...
1
by: Luis Lanuza | last post by:
Hi all, I can't get Visual Studio 2003 to recognize my WindowsXP SP2 regional settings. For ex: On Control Panel / Regional Settings / Regional Options Tab, my standadrs and formats corresponds...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.