Name

LCID

Synopsis

Integer = Session.LCID
Session.LCID = Integer

Returns or sets an Integer containing the locale identifier for the session. The locale identifier determines how information such as date/time values is formatted.

Parameters

Integer

An Integer variable that will receive or set the LCID property value.

Example

The example displays the current LCID value and displays the current date and time formatted based on the current LCID. It then changes the LCID to the value for French, displays the LCID value, and displays the current date and time again, this time formatted based on the new LCID:

Sub Page_Load(  )
   Message.Text = "Current locale ID is: " & Session.LCID & "</br>"
   Message.Text &= "Current date and time is: " & DateTime.Now(  ) & "</br>"
   Session.LCID = 1036 'France
   Message.Text &= "Current locale ID is: " & Session.LCID & "</br>"
   Message.Text &= "Current date and time is: " & DateTime.Now(  ) & "</br>"
End Sub

Notes

The LCID property is provided for backward compatibility with classic ASP. For new ASP.NET development, you should use the System.Threading.CurrentThread.CurrentCulture.LCID property instead. ASP.NET stores and retrieves the Session.LCID property in System.Threading.CurrentThread.CurrentCulture.LCID.

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.