ProfileManager.GetNumberOfProfiles(ProfileAuthenticationOption) Metoda

Definicja

Pobiera liczbę profilów w źródle danych.

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

Parametry

authenticationOption
ProfileAuthenticationOption

ProfileAuthenticationOption Jedna z wartości wyliczenia określająca, czy są zwracane anonimowe, uwierzytelnione, czy oba typy profilów.

Zwraca

Liczba profilów w źródle danych.

Przykłady

Poniższy przykład kodu przedstawia informacje o profilu dla wszystkich profilów skonfigurowanych applicationName , a także zwraca liczbę profilów.

<%@ 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>

Uwagi

Metoda GetNumberOfProfiles służy do pobierania liczby wszystkich profilów użytkowników ze źródła danych dla aplikacji określonej przez applicationName atrybut w pliku konfiguracji. Użyj parametru authenticationOption , aby określić, czy mają być przeszukiwane tylko profile anonimowe, tylko profile uwierzytelnione, czy wszystkie profile.

Dotyczy

Zobacz też