WebSecurity 属性 -CurrentUserName


WebSecurity オブジェクト

定义

CurrentUserName属性は現在のユーザーがWebSecurityデータベース内のユーザー情報テーブルの名前。


C# と VB 構文

WebSecurity.CurrentUserName


实例

实例 C#

@{
string value;
value=WebSecurity.CurrentUserId;
}

<p>Welcome @value</p>

实例 VB

@Code
Dim value as String
value=WebSecurity.CurrentUserName
End Code

<p>Welcome @value</p>


备注

CurrentUserName 属性は読み取り専用です。コードでは変更できません。


エラーと例外

以下の場合、いかなるWebSecurityオブジェクトへのアクセスは、ある例外を投げるInvalidOperationException:

  • InitializeDatabaseConnection()メソッドが呼び出されていません
  • SimpleMembership初期化されていません(またはサイト設定で無効化されています)

技术数据

名称 值
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


WebSecurity オブジェクト 其他扩展