WebSecurity.GetUserId(String) WebSecurity.GetUserId(String) WebSecurity.GetUserId(String) Method

Definition

Returns the ID for a user based on the specified user name.

public static int GetUserId (string userName);
static member GetUserId : string -> int
Public Shared Function GetUserId (userName As String) As Integer
Parameters
userName
String String String

The user name.

Returns

The user ID.

Exceptions

The Initialize(String, NameValueCollection) method was not called.-or-The InitializeDatabaseConnection method was not called.-or-The SimpleMembershipProvider membership provider is not registered in the configuration of your site. For more information, contact your site's system administrator.

Applies to