I am using the CreateUserWizard
to register a user. The control's built-in logic is doing all the work to add the user. However upon registering, I would like the user to be considered "authenticated." I thought that the Authenticate
function would have authenticated me, but the function sets the Authenticated
Boolean to False. Note however that the ValidateUser
function returns True.
How do I automat开发者_如何学Goically sign on/authenticate the use after registering so he doesn't have to "log on" after just registering with his new credentials?
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object,
ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
Dim Authenticated As Boolean =
FormsAuthentication.Authenticate(CreateUserWizard1.UserName,
CreateUserWizard1.Password)
Dim Validated As Boolean = Membership.ValidateUser(CreateUserWizard1.UserName,
CreateUserWizard1.Password)
End Sub
If the validated does indeed turn out to be correct then you can use SetAuthCookie.
精彩评论