CreateUserWizard changed page.User.Identity

D

DAXU

Hi,

I put a CreateUserWizard controll in my page to create users. One
thing I notice is that after a user is created and when I goes to
other pages, the property: Page.User.Identity.Name is changed to the
newly created user.

I guess it is that the CreateUserWizard automatically log the new user
in? My question is that is there a switch or setting to stop this?
My site allow admin user to create users and I don't want newly
created users got logon automatically.

Cheers,

Jerry
 
R

Riki

Hi,

I put a CreateUserWizard controll in my page to create users. One
thing I notice is that after a user is created and when I goes to
other pages, the property: Page.User.Identity.Name is changed to the
newly created user.

I guess it is that the CreateUserWizard automatically log the new user
in? My question is that is there a switch or setting to stop this?
My site allow admin user to create users and I don't want newly
created users got logon automatically.

Don't use the wizard, but use something like the following code to create a
new user (VB.NET):
Try
Dim status As MembershipCreateStatus = Nothing
Dim user As MembershipUser =
Membership.CreateUser(tbUserName.Text, tbPassword.Text, _
tbEmail.Text, strPhrase, strAnswer, True, status)
If (status = MembershipCreateStatus.Success) Then
Roles.AddUserToRole(tbUserName.Text, tbRole.Text)
lblInfo.Text = "The user was successfully added."
Else
lblError.Text = status.ToString()
End If
Catch ex As Exception
lblError.Text = ex.Message
End Try
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top