Have got the code:
VB Code:
Dim objTicket As FormsAuthenticationTicket
Dim objCookie As HttpCookie
Dim strReturnURL As String
If ValidateLogin(txtUsername.Text, txtPassword.Text) Then
objTicket = New FormsAuthenticationTicket(txtUsername.Text, False, 5)
objCookie = New HttpCookie(".ASPXAUTH")
objCookie.Value = FormsAuthentication.Encrypt(objTicket)
Response.Cookies.Add(objCookie)
strReturnURL = Request.Params("ReturnURL")
If strReturnURL Is Nothing Then
Response.Redirect("Main.aspx")
Else
Response.Redirect(strReturnURL)
End If
Else
lblMessage.Text = "Incorect username/password"
End If
And the values in the config file:
Code:
<authentication mode="Forms">
<forms
loginUrl="login.aspx"
protection="All"
slidingExpiration="true"
/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
Woof