Export (0) Print
Expand All

SimpleMembershipProvider.ConfirmAccount Method

Activates a pending membership account.

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

public override bool ConfirmAccount(
	string accountConfirmationToken
)

Parameters

accountConfirmationToken
Type: System.String
A confirmation token to pass to the authentication provider.

Return Value

Type: System.Boolean
true if the user account is confirmed; otherwise, false.

ExceptionCondition
InvalidOperationException

The SimpleMembershipProvider class was not initialized using a call to the InitializeDatabaseConnection() method.

You can require users to confirm their membership before their account is active. To do this, when you create the user account, you call the SimpleMembershipProvider.CreateAccount(String, String, Boolean) or SimpleMembershipProvider.CreateUserAndAccount(String, String, Boolean, IDictionary<String, Object>) method and pass a value that specifies that you want to require confirmation. These methods return a token that uniquely represents the user. You typically construct a hyperlink that points to a confirmation page in your application and that includes the token as a query-string parameter in the link URL. You then send the link to the user in email.

When the user clicks the link, the link invokes your confirmation page. In code for the page, you read the token from the query-string parameter and then call the ConfirmAccount(String) method. If the token is valid, the user account is confirmed and activated.

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