views:

22

answers:

1

Hi there,

I have a kind of asp.net forms authentication with the code like that:

FormsAuthentication.SetAuthCookie(account.Id.ToString(), true);
HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(account.Id.ToString()), null);

What kind of additional efforts shall I take to make authentication cookie (that is user id) more securable? (https, encoding for example)

Thank you in advance!

+1  A: 

To get high security you should enable ssl in your web.config:

MUG4N
Shall I use FormsAuthentication.Encrypt/Decrypt and what is best practice if I want to use not securable http?
Andrew Florko
You should use "Validation" in protection section.See here for more information:http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx
MUG4N
Thank you for the article. I read that "Protection" has "All" option by default (with encoding and this option is recommended). Does it mean I shall take no additional effort to make my cookie securable (for http) ?
Andrew Florko
If you choose "All" you don't have to secure your cookies anymore because the got encrypted.
MUG4N