RolePrincipal.CachedListChanged 속성

정의

RolePrincipal 개체를 사용하여 캐시된 역할 이름의 목록이 수정되었는지 여부를 나타내는 값을 가져옵니다.

public:
 property bool CachedListChanged { bool get(); };
public bool CachedListChanged { get; }
member this.CachedListChanged : bool
Public ReadOnly Property CachedListChanged As Boolean

속성 값

Boolean

RolePrincipal 개체를 사용하여 캐시된 역할 이름의 목록이 수정되었으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 역할 관리를 사용하는 경우 현재 사용자에 대한 역할 캐싱 정보를 표시합니다. 역할 관리를 사용하도록 설정하는 방법에 대한 자세한 내용은 클래스를 참조하세요 Roles .

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Role Information</title>
</head>
<body>

<form id="form1" 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="VB" %>
<%@ Import Namespace="System.Web.Security" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Role Information</title>
</head>
<body>

<form id="form1" 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>

설명

이 속성은 CachedListChanged 기본 역할 Provider 에서 역할 이름을 검색하고 메서드에 의해 캐시에 GetRoles 추가된 후 또는 IsInRole 메서드가 기본 역할 공급자의 메서드를 호출 IsUserInRole 한 다음 응답을 true수신하여 메서드에 전달된 역할 이름이 캐시에 전달된 IsInRole 후에 반환 true 됩니다.

CachedListChanged 설정되고 전달된 경우에도 CookieSlidingExpiration 속성이 true를 true ExpireDate 반환하므로 새 ExpireDate 속성이 설정됩니다.

적용 대상

추가 정보