IIS Development

IisDev

>  Home
>  News

 

Articles

>  Code Samples
>  ASP.NET
>  Security

 

Components & Tools

>  Free Components

 

Service

>  Links
>  Contact us

Session.LCID

A new property that's exposed by the Session object on IIS4 is Session.LCID. If you are used to Win32 programming, you will know what LCID stands for: locale ID. With this locale id, you set things like currency formatting, date and time formatting and so on (check the Regional Settings in Control Panel to get the idea).

If you have developed international web sites, you had to format dates and numbers yourself (relying on the version of NT that is installed was no good idea in case you moved sites from say Germany to a US provider), with IIS4 you only need to set the locale id and everything is done for you. Below you can see locale id's for US English and German as well as how dates are formatted using these locales.

LCID: 1033 12/27/97 3:54:30 PM 
LCID: 3079 27.12.97 15:54:30 

The source code for the ASP file that generated this output is shown in Listing 1. In case you've already programmed using C or C++, you will find the MAKELANGID and MAKELCID "macros" familiar - these are the same as you can find in the Win32 SDK, however, I have ported these to JScript. The include file lcid.asp contains the ported code from the Win32 SDK (and notice that this code is copyrighted by Microsoft). In case you wonder why I chose JScript, take a look at the functions ("macros") - you need shift operators to generate the locale id's.

Download Now! (approx. 3KB)

 

©1998-2018 Christoph Wille. All rights reserved.
All content and images on this site are copyright. Reuse (even parts) needs our written consent.