Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the locale on a Windows Azure Website?

We have a range of Classic ASP applications that we are looking to port to the new Windows Azure Website hosting.

The Classic ASP websites are written against a server that was running in UK locale. The classic ASP has been coded to use UK datetime formats in various ways in hundreds of pages. When I have previously tried the code on servers with US locale the datetime handling fails as the datetime format is different.

Does anyone know if I can specifiy the locale for the website?

Alternatively does anyone know how to change the locale on a standard web role with a start-up task?

like image 457
GraemeMiller Avatar asked Jun 14 '12 22:06

GraemeMiller


1 Answers

If you want to configure the website globalization, it is best to perform using globalization element.

To change locale of your website you can set the culture and uiculture properly in web.config.

In Windows Azure if you want to do it in startup task you would need to create a batch file (i.e. global.cmd) in which can run the following command:

Appcmd set config /commit:WEBROOT /section:globalization /culture: string
Appcmd set config /commit:WEBROOT /section:globalization /uiCulture: string

Above change the "string" to your desired locale code.

Finally you can create startup task as defined in the ServiceDefinition.csdef

<Startup>
 <Task commandLine="global.cmd" executionContext="elevated" taskType="simple" />
</Startup>
like image 109
AvkashChauhan Avatar answered Oct 19 '22 04:10

AvkashChauhan