Its better to use ASP.NET built-in Forms Authentication than writing everything bespoke.

Loads of articles -> http://www.google.co.uk/search?hl=en...e+Search&meta=

HTH

DJ