Hi,
The code for the Button_Click() of Login page.
Sub Button_Click(By Val As Object, By Val As EventArgs)
If IsValid Then
If FormsAuthentication.Authenticate(txtUsername.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUsername.Tex,False)
Else
lblMessage.Text="Bad Username/Password")
End If
End If
End Sub
The above code will first check the username and password passed by the user. If they are valid, it will return true and then go to the next statement. Next, it creates an authentication cookie, attaches it to the outgoing response and redirects user to original requested page. The second parameter specifies whether the aurhentication should be a session cookie (false) or a persistent cookie(true).
the code for Default page
Sun Signout(ByVal objSender As Object,ByVal objArgs EventArgs)
FormsAuthentication.SignOut()
Response.Redirect(Request.UrlReferrer.ToString())
The code for Page_Load method
If user.Identity.IsAuthenticated Then
lblMessage.Text="Sucessful"
Else
lblMessage.Text="Sorry"
End if
End Sub
Regards
bhar
Knowledge is power
http://www.vkinfotek.com