Export (0) Print
Expand All

WebSecurity.UserExists Method

Returns a value that indicates whether the specified user exists in the membership database.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

public static function UserExists(
	userName : String
) : boolean

Parameters

userName
Type: System.String
The user name.

Return Value

Type: System.Boolean
true if the username exists in the user profile table; otherwise, false.

ExceptionCondition
InvalidOperationException

The SimpleMembershipProvider.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.

The method verifies that the user exists in the user profile table. However, it does not verify that a membership account exists for that user.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.
Show:
© 2014 Microsoft