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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top