FormsAuthentication.SetAuthCookie is a short cur to the stuff I showed you. It's easier to use, because all it needs is a username, a bool indicating the persistence, and optionally a cookie path.
Internally, I assume this method does more or less the same as my code. However, with my code, you have the ability to store additional UserData. In most of my (commercial) intranet sites, I store the User's GUID encrypted in this UserData part of the ticket, so it's easy to retrieve the UserID later on in the site.
Take a look here for more info: ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebsecurityformsauthenticationclassseta uthcookietopic2.htm
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|