Aracılığıyla paylaş


ProfileManager.GetNumberOfProfiles(ProfileAuthenticationOption) Yöntem

Tanım

Veri kaynağındaki profil sayısını alır.

public:
 static int GetNumberOfProfiles(System::Web::Profile::ProfileAuthenticationOption authenticationOption);
public static int GetNumberOfProfiles (System.Web.Profile.ProfileAuthenticationOption authenticationOption);
static member GetNumberOfProfiles : System.Web.Profile.ProfileAuthenticationOption -> int
Public Shared Function GetNumberOfProfiles (authenticationOption As ProfileAuthenticationOption) As Integer

Parametreler

authenticationOption
ProfileAuthenticationOption

ProfileAuthenticationOption Anonim, kimliği doğrulanmış veya her iki profil türünün de döndürüleceğini belirten numaralandırma değerlerinden biri.

Döndürülenler

Veri kaynağındaki profil sayısı.

Örnekler

Aşağıdaki kod örneği, yapılandırılan applicationName tüm profillerin profil bilgilerini görüntüler ve ayrıca profil sayısını döndürür.

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Profile" %>
<!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()
{
  TotalLabel.Text = ProfileManager.GetNumberOfProfiles(ProfileAuthenticationOption.All).ToString();
  GetProfiles();
}

private void GetProfiles()
{
  ProfileGrid.DataSource = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All);
  ProfileGrid.DataBind();
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Sample: Find Profiles</title>
</head>
<body>

<form id="form1" runat="server">
  <h3>Profile List</h3>

  <asp:Label id="TotalLabel" runat="server" text="0" /> Profiles found.<br />

  <asp:GridView id="ProfileGrid" runat="server"
                CellPadding="2" CellSpacing="1" Gridlines="Both">
    <HeaderStyle BackColor="darkblue" ForeColor="white" />
  </asp:GridView>

</form>

</body>
</html>
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Profile" %>
<!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()
  TotalLabel.Text = ProfileManager.GetNumberOfProfiles(ProfileAuthenticationOption.All).ToString()
  GetProfiles()
End Sub

Private Sub GetProfiles()
  ProfileGrid.DataSource = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All)
  ProfileGrid.DataBind()
End Sub

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Sample: Find Profiles</title>
</head>
<body>

<form id="form1" runat="server">
  <h3>Profile List</h3>

  <asp:Label id="TotalLabel" runat="server" text="0" /> Profiles found.<br />

  <asp:GridView id="ProfileGrid" runat="server"
                CellPadding="2" CellSpacing="1" Gridlines="Both">
    <HeaderStyle BackColor="darkblue" ForeColor="white" />
  </asp:GridView>

</form>

</body>
</html>

Açıklamalar

GetNumberOfProfiles yöntemi, yapılandırma dosyasında özniteliği tarafından applicationName belirtilen uygulamanın veri kaynağından tüm kullanıcı profillerinin sayısını almak için kullanılır. authenticationOption Yalnızca anonim profillerin mi, yalnızca kimliği doğrulanmış profillerin mi yoksa tüm profillerin mi aranmasını istediğinizi belirtmek için parametresini kullanın.

Şunlara uygulanır

Ayrıca bkz.