Using FormsAuthentication build into asp.net it's very quick and easy to create a login system that creates a cookie for authenticated users:
FormsAuthentication.SetAuthCookie(uniqueUsername, false);
Paired with some code in the Web.Config file:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="30" defaultUrl="Dashboard.aspx" protection="All" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
This will bounce all requests back to Login.aspx until the user is approved and a cookie is created using the SetAuthCookie() method call.
Is this secure enough?
The rule of thumb I use is that I don't store any data on the client that they've not sent me. So what I've done in the past is hold the username and password used in a cookie, then re-authentic this with every request.
There's the extra overhead of re-authenticating everytime with this approach, but it also means I've not storing any server data on the client.
My worry
My concern is that by using the SetAuthCookie() method call, that the username is being stored on the client machine. Is it then possible for someone to break the encryption being used and substitute the username being stored for another?
I think I'm being overly paranoid and that the type and level of encryption being used is adequate, but thought I'd get some expert input on the topic.