Here's some of my code.
Login.aspx (note: this is just the code, not the markup part with the html)
My authentication method that gets called from the code above
And finally, the web.config file. Add these lines between your system.web tags.
The web.config is one of the most important parts. The first tag in it tells asp.net to use forms authentication for this application. The loginUrl parameter sets the login form that they will automatically be redirected to if they are not logged in.
The authorization tag is just saying, "asp.net, deny all users who are anonymous (the question mark means anonymous)".
What you may want to do is implement the code in the web.config first, create a login.aspx page and just test it out. If you go to a page in your application when you are not authenticated and you end up getting redirected to login.aspx, then it's working.