ProfileManager.GetNumberOfProfiles(ProfileAuthenticationOption) Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het aantal profielen in de gegevensbron op.
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
Parameters
- authenticationOption
- ProfileAuthenticationOption
Een van de ProfileAuthenticationOption opsommingswaarden, waarmee wordt opgegeven of anonieme, geverifieerde of beide typen profielen worden geretourneerd.
Retouren
Het aantal profielen in de gegevensbron.
Voorbeelden
In het volgende codevoorbeeld worden profielgegevens weergegeven voor alle profielen voor de geconfigureerde applicationName profielen en wordt ook het aantal profielen geretourneerd.
<%@ 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>
Opmerkingen
De GetNumberOfProfiles methode wordt gebruikt om een telling van alle gebruikersprofielen op te halen uit de gegevensbron voor de toepassing die is opgegeven door het applicationName kenmerk in het configuratiebestand. Gebruik de authenticationOption parameter om op te geven of u alleen anonieme profielen, alleen geverifieerde profielen of alle profielen wilt doorzoeken.