How to login from code view?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know this must be simple, but i can't figure it out.

i'm creating user's from the code view using code similiar to this..

......
If Membership.RequiresQuestionAndAnswer Then
newUser = Membership.CreateUser( _
UserName.Text, _
Password.Text, _
Email.Text, _
Question.Text, _
Answer.Text, _
True, _
result)
Else
newUser = Membership.CreateUser( _
UserName.Text, _
Password.Text, _
Email.Text)
End If


If result = MembershipCreateStatus.Success Then
'log in user...
end if

i would like to login the user if the account is created. is ther some
library that i can include that has a login function?

maybe login(username,password)?

thanks for any help.
 
I think you can do it like this:

FormsAuthentication.SetAuthCookie _
(UserName.Text, True)

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]
 
Thanks a million. I knew there had to be a simple solution :).

Ken Cox - Microsoft MVP said:
I think you can do it like this:

FormsAuthentication.SetAuthCookie _
(UserName.Text, True)

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]


Fabuloussites said:
I know this must be simple, but i can't figure it out.

i'm creating user's from the code view using code similiar to this..

.....
If Membership.RequiresQuestionAndAnswer Then
newUser = Membership.CreateUser( _
UserName.Text, _
Password.Text, _
Email.Text, _
Question.Text, _
Answer.Text, _
True, _
result)
Else
newUser = Membership.CreateUser( _
UserName.Text, _
Password.Text, _
Email.Text)
End If


If result = MembershipCreateStatus.Success Then
'log in user...
end if

i would like to login the user if the account is created. is ther some
library that i can include that has a login function?

maybe login(username,password)?

thanks for any help.
 

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

Back
Top