Sorry another probably easy question...
I have a login procedure where I set a cookie - Below
FormsAuthentication.SetAuthCookie(LoggedInUserId, True)
Can I append other information within this cookie? not just the UserId and the Boolean? If I can whats the syntax?
Thanks in advance...
Ok. I take it back. I think there is actually a way. Look at the following code from the Reflector
publicstaticvoidSetAuthCookie(string userName,bool createPersistentCookie){FormsAuthentication.Initialize();FormsAuthentication.SetAuthCookie(userName,createPersistentCookie,FormsAuthentication.FormsCookiePath);}
publicstaticvoidSetAuthCookie(string userName,bool createPersistentCookie,string strCookiePath){FormsAuthentication.Initialize();HttpContext.Current.Response.Cookies.Add(FormsAuthentication.GetAuthCookie(userName,createPersistentCookie,strCookiePath));}You could do it by overriding the SetSuthCookie method. Is there a reason you cannot just add another cookie with the information you need?
Thanks for the answers lads... Appreciated...
I think I need to look into how to set my own cookie... Got any reference sites or examples about setting your own cookies??
Thanks in advance
http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx#cookies
This is a whole page on managing state in ASP.NET, of which using cookies is one technique.
Thanks Lee...
0 comments:
Post a Comment