CreateUserWizard changed page.User.Identity
am 17.11.2007 20:15:36 von 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
Re: CreateUserWizard changed page.User.Identity
am 19.11.2007 12:58:29 von Riki
DAXU@hotmail.com wrote:
> 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
--
Riki
RE: CreateUserWizard changed page.User.Identity
am 21.12.2007 04:03:00 von frank
Set the property - LoginCreatedUser to False.
"DAXU@hotmail.com" wrote:
> 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
>