RolePrincipal.Identity プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > RolePrincipal.Identity プロパティの意味・解説 

RolePrincipal.Identity プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

現在の HTTP 要求セキュリティ ID取得します

名前空間: System.Web.Security
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As RolePrincipal
Dim value As IIdentity

value = instance.Identity
public IIdentity Identity { get; }
public:
virtual property IIdentity^ Identity {
    IIdentity^ get () sealed;
}
/** @property */
public final IIdentity get_Identity ()

プロパティ
現在の HTTP 要求セキュリティ ID

使用例使用例

ロール管理有効になっている場合に、現在のユーザーロールキャッシュ情報表示する例を次に示しますロール管理有効化詳細については、Roles クラストピック参照してください

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Security"
 %>

<script runat="server">

Public Sub Page_Load()

    Try
    Dim r As RolePrincipal = CType(User, RolePrincipal)

    IsCachedLabel.Text     = r.IsRoleListCached.ToString()
    CacheChangedLabel.Text = r.CachedListChanged.ToString()
    ExpiredLabel.Text      = r.Expired.ToString()
    VersionLabel.Text      = r.Version.ToString()
    IssueDateLabel.Text    = r.IssueDate.ToString()
    ExpireDateLabel.Text   = r.ExpireDate.ToString()
    CookiePathLabel.Text   = r.CookiePath

    Msg.Text = ""
  Catch e As InvalidCastException
    Msg.Text = "User is not of type RolePrincipal. Are roles enabled?"
  End Try

End Sub

</script>
<html>
<head>
<title>Role Information</title>
</head>
<body>

<form runat="server">

  Role Information for <B><%=User.Identity.Name%></B>.<BR>

  <asp:Label id="Msg" runat="Server"
 ForeColor="maroon" /><BR>

  <table border=1 cellpadding=4 cellspacing=4>
    <tr>
      <td>IsRoleListCached</td>
      <td><asp:Label id="IsCachedLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>CachedListChanged</td>  
      <td><asp:Label id="CacheChangedLabel"
 runat="Server" /></td>
    </tr>
    <tr>
      <td>Expired</td>
      <td><asp:Label id="ExpiredLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>Version</td>
      <td><asp:Label id="VersionLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>IssueDate</td>
      <td><asp:Label id="IssueDateLabel"
 runat="Server" /></td>
    </tr>
    <tr>
      <td>ExpireDate</td>
      <td><asp:Label id="ExpireDateLabel"
 runat="Server" /></td>
    </tr>
    <tr>
      <td>CookiePath</td>
      <td><asp:Label id="CookiePathLabel"
 runat="Server" /></td>
    </tr>
  </table>

</form>


</body>
</html>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>

<script runat="server">

public void Page_Load()
{

  try
  {
    RolePrincipal r = (RolePrincipal)User;

    IsCachedLabel.Text     = r.IsRoleListCached.ToString();
    CacheChangedLabel.Text = r.CachedListChanged.ToString();
    ExpiredLabel.Text      = r.Expired.ToString();
    VersionLabel.Text      = r.Version.ToString();
    IssueDateLabel.Text    = r.IssueDate.ToString();
    ExpireDateLabel.Text   = r.ExpireDate.ToString();
    CookiePathLabel.Text   = r.CookiePath;

    Msg.Text = "";
  }
  catch (InvalidCastException)
  {
    Msg.Text = "User is not of type RolePrincipal. Are roles enabled?";
  }

}

</script>
<html>
<head>
<title>Role Information</title>
</head>
<body>

<form runat="server">

  Role Information for <B><%=User.Identity.Name%></B>.<BR>

  <asp:Label id="Msg" runat="Server" ForeColor="maroon"
 /><BR>

  <table border=1 cellpadding=4 cellspacing=4>
    <tr>
      <td>IsRoleListCached</td>
      <td><asp:Label id="IsCachedLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>CachedListChanged</td>  
      <td><asp:Label id="CacheChangedLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>Expired</td>
      <td><asp:Label id="ExpiredLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>Version</td>
      <td><asp:Label id="VersionLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>IssueDate</td>
      <td><asp:Label id="IssueDateLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>ExpireDate</td>
      <td><asp:Label id="ExpireDateLabel" runat="Server"
 /></td>
    </tr>
    <tr>
      <td>CookiePath</td>
      <td><asp:Label id="CookiePathLabel" runat="Server"
 /></td>
    </tr>
  </table>

</form>


</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「RolePrincipal.Identity プロパティ」の関連用語

RolePrincipal.Identity プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RolePrincipal.Identity プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS