Click here to Skip to main content
15,886,518 members
Articles / Web Development

Service Based Membership Providers for ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.93/5 (45 votes)
4 May 2014CPOL29 min read 131.6K   8.2K   173  
Service based, multi-application ASP.NET custom membership, role and profile providers with a hierarchical role system.
<html xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:mshelp="http://msdn.microsoft.com/mshelp"><head><link rel="SHORTCUT ICON" href="./../icons/favicon.ico" /><style type="text/css">.OH_CodeSnippetContainerTabLeftActive, .OH_CodeSnippetContainerTabLeft,.OH_CodeSnippetContainerTabLeftDisabled { backgroundImageName: tabLeftBG.gif; }.OH_CodeSnippetContainerTabRightActive, .OH_CodeSnippetContainerTabRight,.OH_CodeSnippetContainerTabRightDisabled { backgroundImageName: tabRightBG.gif; }.OH_footer { backgroundImageName: footer_slice.gif; background-position: top; background-repeat: repeat-x; }</style><link rel="stylesheet" type="text/css" href="./../styles/branding.css" /><link rel="stylesheet" type="text/css" href="./../styles/branding-en-US.css" /><style type="text/css">
			body
			{
			border-left:5px solid #e6e6e6;
			overflow-x:scroll;
			overflow-y:scroll;
			}
		</style><script src="./../scripts/branding.js" type="text/javascript"><!----></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>AspNetProfileProvider.FindProfilesByUserName Method </title><meta name="Language" content="en-us" /><meta name="System.Keywords" content="FindProfilesByUserName method" /><meta name="System.Keywords" content="AspNetProfileProvider.FindProfilesByUserName method" /><meta name="Microsoft.Help.F1" content="Archymeta.Web.Security.AspNetProfileProvider.FindProfilesByUserName" /><meta name="Microsoft.Help.Id" content="M:Archymeta.Web.Security.AspNetProfileProvider.FindProfilesByUserName(System.Web.Profile.ProfileAuthenticationOption,System.String,System.Int32,System.Int32,System.Int32@)" /><meta name="Description" content="Retrieve profile information for profiles in which the user name matches the specified user names." /><meta name="Microsoft.Help.ContentType" content="Reference" /><meta name="BrandingAware" content="'true'" /><meta name="container" content="Archymeta.Web.Security" /><meta name="file" content="2ba2eba2-bc12-2dc5-b77d-30f39f5963f0" /><meta name="guid" content="2ba2eba2-bc12-2dc5-b77d-30f39f5963f0" /><link type="text/css" rel="stylesheet" href="ms-help://Hx/HxRuntime/HxLink.css" /><meta name="SelfBranded" content="true" /></head><body onload="onLoad()" class="primary-mtps-offline-document"><div class="OH_outerDiv"><div class="OH_outerContent"><table class="TitleTable"><tr><td class="OH_tdTitleColumn">AspNetProfileProvider<span id="ID0EBBABAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0EBBABAAA?vb=.|cpp=::|cs=.|fs=.|nu=.");
				</script>FindProfilesByUserName Method </td><td class="OH_tdRunningTitleColumn">Service Proxy API for Membership data sources</td></tr></table><div id="mainSection"><div id="mainBody"><span class="introStyle"></span><p style="color: #dc143c; font-size: 8.5pt; font-weight: bold;">[This is preliminary documentation and is subject to change.]</p><div class="summary">
            Retrieve profile information for profiles in which the user name matches the specified user names.
            </div><p></p><b>Namespace:</b> <a href="bcc47ac0-24ce-49cf-165f-b977af57e4ec.htm" target="">Archymeta.Web.Security</a><br /><b>Assembly:</b> <span sdata="assembly">AspNetUserServiceProvider</span> (in AspNetUserServiceProvider.dll) Version: 1.0.0.0 (1.0.0.0)<div class="OH_CollapsibleAreaRegion"><div class="OH_regiontitle">Syntax</div><div class="OH_CollapsibleArea_HrDiv"><hr class="OH_CollapsibleArea_Hr" /></div></div><div class="OH_clear"></div><div id="snippetGroup_Syntax" class="code"><div id="ID0EDICAAAAA" class="OH_CodeSnippetContainer"><div class="OH_CodeSnippetContainerTabs" id="ID0EDICAAAAA_tabs"><div class="OH_CodeSnippetContainerTabLeftActive" id="ID0EDICAAAAA_tabimgleft"></div><div id="ID0EDICAAAAA_tab1" class="OH_CodeSnippetContainerTabActive" EnableCopyCode="true"><a href="#" onclick="javascript:ChangeTab('ID0EDICAAAAA','C#','1','4');return false;">C#</a></div><div id="ID0EDICAAAAA_tab2" class="OH_CodeSnippetContainerTab" EnableCopyCode="true"><a href="#" onclick="javascript:ChangeTab('ID0EDICAAAAA','Visual Basic','2','4');return false;">VB</a></div><div id="ID0EDICAAAAA_tab3" class="OH_CodeSnippetContainerTab" EnableCopyCode="true"><a href="#" onclick="javascript:ChangeTab('ID0EDICAAAAA','Visual C++','3','4');return false;">C++</a></div><div id="ID0EDICAAAAA_tab4" class="OH_CodeSnippetContainerTab" EnableCopyCode="true"><a href="#" onclick="javascript:ChangeTab('ID0EDICAAAAA','F#','4','4');return false;">F#</a></div><div class="OH_CodeSnippetContainerTabRight" id="ID0EDICAAAAA_tabimgright"></div></div><div id="ID0EDICAAAAA_codecollection" class="OH_CodeSnippetContainerCodeCollection"><div class="OH_CodeSnippetToolBar"><div class="OH_CodeSnippetToolBarText"><a id="ID0EDICAAAAA_ViewColorized" href="#" onclick="javascript:ExchangeTitleContent('ID0EDICAAAAA','4')" title="View Colorized" style="display: none">View Colorized</a><a id="ID0EDICAAAAA_copycode" href="#" onclick="javascript:CopyToClipboard('ID0EDICAAAAA','4')" title="Copy to Clipboard">Copy to Clipboard</a><a id="ID0EDICAAAAA_PrintText" class="OH_PrintText" href="#" onclick="javascript:Print('ID0EDICAAAAA','4')" title="Print">Print</a></div></div><div id="ID0EDICAAAAA_code_Div1" class="OH_CodeSnippetContainerCode" style="display: block"><pre><span class="keyword">public</span> <span class="keyword">override</span> <span class="identifier">ProfileInfoCollection</span> <span class="identifier">FindProfilesByUserName</span>(
	<span class="identifier">ProfileAuthenticationOption</span> <span class="parameter">authenticationOption</span>,
	<span class="identifier">string</span> <span class="parameter">usernameToMatch</span>,
	<span class="identifier">int</span> <span class="parameter">pageIndex</span>,
	<span class="identifier">int</span> <span class="parameter">pageSize</span>,
	<span class="keyword">out</span> <span class="identifier">int</span> <span class="parameter">totalRecords</span>
)</pre></div><div id="ID0EDICAAAAA_code_Plain_Div1" class="OH_CodeSnippetContainerCode" style="display: none"><pre>public override ProfileInfoCollection FindProfilesByUserName(
	ProfileAuthenticationOption authenticationOption,
	string usernameToMatch,
	int pageIndex,
	int pageSize,
	out int totalRecords
)</pre></div><div id="ID0EDICAAAAA_code_Div2" class="OH_CodeSnippetContainerCode" style="display: none"><pre><span class="keyword">Public</span> <span class="keyword">Overrides</span> <span class="keyword">Function</span> <span class="identifier">FindProfilesByUserName</span> ( 
	<span class="parameter">authenticationOption</span> <span class="keyword">As</span> <span class="identifier">ProfileAuthenticationOption</span>,
	<span class="parameter">usernameToMatch</span> <span class="keyword">As</span> <span class="identifier">String</span>,
	<span class="parameter">pageIndex</span> <span class="keyword">As</span> <span class="identifier">Integer</span>,
	<span class="parameter">pageSize</span> <span class="keyword">As</span> <span class="identifier">Integer</span>,
	&lt;<span class="identifier">OutAttribute</span>&gt; <span class="keyword">ByRef</span> <span class="parameter">totalRecords</span> <span class="keyword">As</span> <span class="identifier">Integer</span>
) <span class="keyword">As</span> <span class="identifier">ProfileInfoCollection</span></pre></div><div id="ID0EDICAAAAA_code_Plain_Div2" class="OH_CodeSnippetContainerCode" style="display: none"><pre>Public Overrides Function FindProfilesByUserName ( 
	authenticationOption As ProfileAuthenticationOption,
	usernameToMatch As String,
	pageIndex As Integer,
	pageSize As Integer,
	&lt;OutAttribute&gt; ByRef totalRecords As Integer
) As ProfileInfoCollection</pre></div><div id="ID0EDICAAAAA_code_Div3" class="OH_CodeSnippetContainerCode" style="display: none"><pre><span class="keyword">public</span>:
<span class="keyword">virtual</span> <span class="identifier">ProfileInfoCollection</span>^ <span class="identifier">FindProfilesByUserName</span>(
	<span class="identifier">ProfileAuthenticationOption</span> <span class="parameter">authenticationOption</span>, 
	<span class="identifier">String</span>^ <span class="parameter">usernameToMatch</span>, 
	<span class="identifier">int</span> <span class="parameter">pageIndex</span>, 
	<span class="identifier">int</span> <span class="parameter">pageSize</span>, 
	[<span class="identifier">OutAttribute</span>] <span class="identifier">int</span>% <span class="parameter">totalRecords</span>
) <span class="keyword">override</span></pre></div><div id="ID0EDICAAAAA_code_Plain_Div3" class="OH_CodeSnippetContainerCode" style="display: none"><pre>public:
virtual ProfileInfoCollection^ FindProfilesByUserName(
	ProfileAuthenticationOption authenticationOption, 
	String^ usernameToMatch, 
	int pageIndex, 
	int pageSize, 
	[OutAttribute] int% totalRecords
) override</pre></div><div id="ID0EDICAAAAA_code_Div4" class="OH_CodeSnippetContainerCode" style="display: none"><pre><span class="keyword">abstract</span> <span class="identifier">FindProfilesByUserName</span> : 
        <span class="parameter">authenticationOption</span> : <span class="identifier">ProfileAuthenticationOption</span> * 
        <span class="parameter">usernameToMatch</span> : <span class="identifier">string</span> * 
        <span class="parameter">pageIndex</span> : <span class="identifier">int</span> * 
        <span class="parameter">pageSize</span> : <span class="identifier">int</span> * 
        <span class="parameter">totalRecords</span> : <span class="identifier">int</span> <span class="keyword">byref</span> <span class="keyword">-&gt;</span> <span class="identifier">ProfileInfoCollection</span> 
<span class="keyword">override</span> <span class="identifier">FindProfilesByUserName</span> : 
        <span class="parameter">authenticationOption</span> : <span class="identifier">ProfileAuthenticationOption</span> * 
        <span class="parameter">usernameToMatch</span> : <span class="identifier">string</span> * 
        <span class="parameter">pageIndex</span> : <span class="identifier">int</span> * 
        <span class="parameter">pageSize</span> : <span class="identifier">int</span> * 
        <span class="parameter">totalRecords</span> : <span class="identifier">int</span> <span class="keyword">byref</span> <span class="keyword">-&gt;</span> <span class="identifier">ProfileInfoCollection</span> </pre></div><div id="ID0EDICAAAAA_code_Plain_Div4" class="OH_CodeSnippetContainerCode" style="display: none"><pre>abstract FindProfilesByUserName : 
        authenticationOption : ProfileAuthenticationOption * 
        usernameToMatch : string * 
        pageIndex : int * 
        pageSize : int * 
        totalRecords : int byref -&gt; ProfileInfoCollection 
override FindProfilesByUserName : 
        authenticationOption : ProfileAuthenticationOption * 
        usernameToMatch : string * 
        pageIndex : int * 
        pageSize : int * 
        totalRecords : int byref -&gt; ProfileInfoCollection </pre></div></div></div><script>addSpecificTextLanguageTagSet('ID0EDICAAAAA');</script></div><div id="parameters"><h4 class="subHeading">Parameters</h4><dl paramName="authenticationOption"><dt><span class="parameter">authenticationOption</span></dt><dd>Type: <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/7427y1ec" target="_blank">System.Web.Profile<span id="ID0EBCAEHCAAAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0EBCAEHCAAAAA?vb=.|cpp=::|cs=.|fs=.|nu=.");
				</script>ProfileAuthenticationOption</a><br /><span>
            One of the <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/7427y1ec" target="_blank">ProfileAuthenticationOption</a> values, specifying whether anonymous, authenticated, or both types of profiles are returned.
            </span></dd></dl><dl paramName="usernameToMatch"><dt><span class="parameter">usernameToMatch</span></dt><dd>Type: <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">System<span id="ID0EBCADHCAAAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0EBCADHCAAAAA?vb=.|cpp=::|cs=.|fs=.|nu=.");
				</script>String</a><br /><span>
            The user name to search for.
            </span></dd></dl><dl paramName="pageIndex"><dt><span class="parameter">pageIndex</span></dt><dd>Type: <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/td2s409d" target="_blank">System<span id="ID0EBCACHCAAAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0EBCACHCAAAAA?vb=.|cpp=::|cs=.|fs=.|nu=.");
				</script>Int32</a><br /><span>
            The index of the page of results to return.
            </span></dd></dl><dl paramName="pageSize"><dt><span class="parameter">pageSize</span></dt><dd>Type: <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/td2s409d" target="_blank">System<span id="ID0EBCABHCAAAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0EBCABHCAAAAA?vb=.|cpp=::|cs=.|fs=.|nu=.");
				</script>Int32</a><br /><span>
            The size of the page of results to return.
            </span></dd></dl><dl paramName="totalRecords"><dt><span class="parameter">totalRecords</span></dt><dd>Type: <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/td2s409d" target="_blank">System<span id="ID0EBDAAHCAAAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0EBDAAHCAAAAA?vb=.|cpp=::|cs=.|fs=.|nu=.");
				</script>Int32</a><span id="ID0ECAAHCAAAAA"> </span><script type="text/javascript">
					addToLanSpecTextIdSet("ID0ECAAHCAAAAA?vb=|cpp=%|cs=|fs=|nu=");
				</script><br /><span>
            When this method returns, contains the total number of profiles.
            </span></dd></dl></div><h4 class="subHeading">Return Value</h4>Type: <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/41a5sxb6" target="_blank">ProfileInfoCollection</a><br />
            A <img src="./../icons/online_icon.gif" class="OH_offlineIcon" alt="Online" title="Online" /><a href="http://msdn2.microsoft.com/en-us/library/41a5sxb6" target="_blank">ProfileInfoCollection</a> containing user-profile information for all profiles in the data source.
            <a name="seeAlsoSection"><!----></a><div class="OH_CollapsibleAreaRegion"><div class="OH_regiontitle">See Also</div><div class="OH_CollapsibleArea_HrDiv"><hr class="OH_CollapsibleArea_Hr" /></div></div><div class="OH_clear"></div><div class="seeAlsoStyle"><a href="d53849c2-1201-56ca-51a3-bd25702471ef.htm" target="">AspNetProfileProvider Class</a></div><div class="seeAlsoStyle"><a href="62ae5ee0-de2b-c4d1-a904-5579fc88e435.htm" target="">AspNetProfileProvider Members</a></div><div class="seeAlsoStyle"><a href="bcc47ac0-24ce-49cf-165f-b977af57e4ec.htm" target="">Archymeta.Web.Security Namespace</a></div></div></div></div></div><div id="OH_footer" class="OH_footer"><p /><div class="OH_feedbacklink"><a href="mailto:?subject=Service+Proxy+API+for+Membership+data+sources+AspNetProfileProvider.FindProfilesByUserName+Method++100+EN-US&amp;body=Your%20feedback%20is%20used%20to%20improve%20the%20documentation%20and%20the%20product.%20Your%20e-mail%20address%20will%20not%20be%20used%20for%20any%20other%20purpose%20and%20is%20disposed%20of%20after%20the%20issue%20you%20report%20is%20resolved.%20While%20working%20to%20resolve%20the%20issue%20that%20you%20report%2c%20you%20may%20be%20contacted%20via%20e-mail%20to%20get%20further%20details%20or%20clarification%20on%20the%20feedback%20you%20sent.%20After%20the%20issue%20you%20report%20has%20been%20addressed%2c%20you%20may%20receive%20an%20e-mail%20to%20let%20you%20know%20that%20your%20feedback%20has%20been%20addressed.">Send Feedback</a> on this topic.</div></div></body></html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder CryptoGateway Software Inc.
Canada Canada


His interests in software research and development include security, domain specific meta-language development technologies and tools, meta-language driven code generation, generation of non-invasive and virtual SQL database for "un-structured" data (sqlization), automated relational data service production technologies, file system sqlization technologies and products, structured multi-lingual documentation tools and technologies, sqlization of user's personal data, like emails, etc..


He was a physicist before year 2000. He studied theoretical physics (the hidden symmetry between the past and future, quantum field theories, mirror universe, cosmological dark energies etc.) in which he think to had made fundamental breakthroughs[^] but the community is either not ready for it or is actively rejecting/ignoring it Smile | :) .



It struck me on Apr. 11, 2023 that the said theory above can even generate General Relativity naturally after a recent discussion in the Insider News group that triggers a rethinking of the subject on my side. The first stage of the work is completed in Sept. 2023, it is and will be continue to be published online

  • On Vacuum
  • Quantum and Gravity







    Most recent software system to share:



    • V-NET[^] - Full stack virtualization management system including networking, storage, virtual machines and containers, with an emphasis on networking ... to be released.

Comments and Discussions