通过


IHttpSessionState.LCID 属性

定义

获取或设置当前会话的区域设置标识符(LCID)。

public:
 property int LCID { int get(); void set(int value); };
public int LCID { get; set; }
member this.LCID : int with get, set
Public Property LCID As Integer

属性值

一个 CultureInfo 指定当前会话区域性的实例。

示例

下面的代码示例实现 LCID 接口的属性 IHttpSessionState ,以获取和设置当前页的区域设置标识符。

//
// Session.LCID exists only to support legacy ASP compatibility. ASP.NET developers should use
// Page.LCID instead.
//
public int LCID
{
  get { return Thread.CurrentThread.CurrentCulture.LCID; }
  set { Thread.CurrentThread.CurrentCulture = CultureInfo.ReadOnly(new CultureInfo(value)); }
}
'
    ' Session.LCID exists only to support legacy ASP compatibility. ASP.NET developers should use
' Page.LCID instead.
'
Public Property LCID As Integer Implements IHttpSessionState.LCID
  Get
    Return Thread.CurrentThread.CurrentCulture.LCID
  End Get
  Set
    Thread.CurrentThread.CurrentCulture = CultureInfo.ReadOnly(new CultureInfo(value))
  End Set
End Property

注解

仅提供此属性 LCID 是为了与早期版本的 ASP 兼容。 如果不需要保持与 ASP 页面的向后兼容性,请改用该 LCID 属性。

ASP.NET 不将区域设置标识符存储在会话状态中。 该 LCID 属性调用 LCID 获取和设置标识符。

适用于

另请参阅