all groups > asp.net security > september 2004 >
You're in the

asp.net security

group:

FormsAuthenticationTicket does not return userdata


FormsAuthenticationTicket does not return userdata shaddock NO[at]SPAM -NOSPAM-gmail.com
9/14/2004 6:38:36 AM
asp.net security:
Hello,

I am trying to get FormAuthentication working, but the FormsAuthenticationTicket does not return the UserData. Does any one have any insight into this?

To create a Authorization ticket, I am using this code:

//grab the roles for this user. Pipe delimited string.
string roles = RetrieveRoles(custID);
//roles now equals something like "Manager|User"



//create an auth ticket.
FormsAuthenticationTicket authTicket =
new FormsAuthenticationTicket(
1,
custID,
DateTime.Now,
DateTime.Now.AddMinutes(10),
false,
roles
);


To get the roles I am using this code:

string[] roles = authTicket.UserData.Split(new char[]{'|'});

Thanks

Stewart

---
Posted using Wimdows.net NntpNews Component -

Re: FormsAuthenticationTicket does not return userdata Joseph E Shook [MVP - ADSI]
9/20/2004 12:58:28 AM
Recently I ran into the same behavior.

I decided to use FormsAuthentication.RedirectFromLoginPage(userName,
False) instead of
Response.Redirect(FormsAuthentication.GetRedirectUrl(userName, False)).

RedirectFromLoginPage issues an authentication ticket which then blows
away your ticket. Granted this is a comment I wrote in my blog a while
back but have a suspicion this may help you.
AddThis Social Bookmark Button