This is what I sue and it seems to work.
I am not to hot at ASP.NET yet, but it seems straight forward.

In your Web.Config file you need:
Code:
    <authentication mode="Forms">
		<forms
			name=".ASPXAUTH" 
			loginUrl="login.aspx" 
			protection="All"
			slidingExpiration="true" 
			timeout = "10"
		/>
    </authentication> 
    <authorization>
		<deny users="?" />
    </authorization>
I have a login page, which I am assuming you have to.
The code in my "login" button is:
VB Code:
  1. Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
  2.         Dim objTicket As FormsAuthenticationTicket
  3.         Dim objCookie As HttpCookie
  4.         Dim strReturnURL As String
  5.         If IsValid Then
  6.             If txtUsername.Text = "wokawidget" And txtPassword.Text = "woof" Then
  7.                 objTicket = New FormsAuthenticationTicket(txtUsername.Text, False, 5)
  8.                 objCookie = New HttpCookie(".ASPXAUTH")
  9.                 objCookie.Value = FormsAuthentication.Encrypt(objTicket)
  10.                 Response.Cookies.Add(objCookie)
  11.                 strReturnURL = Request.Params("ReturnURL")
  12.                 If strReturnURL Is Nothing Then
  13.                     Response.Redirect("Main.aspx")
  14.                 Else
  15.                     Response.Redirect(strReturnURL)
  16.                 End If
  17.             Else
  18.                 lblMessage.Text = "Incorect username/password"
  19.             End If
  20.         Else
  21.             lblMessage.Text = "Incorect username/password"
  22.  
  23.         End If
  24.     End Sub
You need to import System.Web.Security for this.
I am currently learning more about this subject, and am just in the process of having users in a DB table.

Both the Login page, and the web config file, have references to ".ASPXAUTH". These MUST be the same name! It could be ".WOOF" for all you care, but so long as they are the same it will work.

Woka