I manage to store the additional use data (username, fullname, rolecode) in FormAuthenticat ionTicket. However ,
the user has more than one role , he can be admin, poweruser , executive ,etc... can anyone please tell me how can i concatenate the rodecode return by datareader if it returns more than 1 value? so that i can put it as a string in userdatastring of the authentication ticket?
eg:
If datareader returns:
UserName FullName RoleCode
amy33 amy watson ADMIN
amy33 amy watson POWERUSER
amy33 amy watson EXEC
how can i can i store all this 3 RoleCode in userdatastring?
Thank you !
the user has more than one role , he can be admin, poweruser , executive ,etc... can anyone please tell me how can i concatenate the rodecode return by datareader if it returns more than 1 value? so that i can put it as a string in userdatastring of the authentication ticket?
eg:
If datareader returns:
UserName FullName RoleCode
amy33 amy watson ADMIN
amy33 amy watson POWERUSER
amy33 amy watson EXEC
how can i can i store all this 3 RoleCode in userdatastring?
Thank you !
Code:
drDataReader = cmd.ExecuteReader()
While drDataReader.Read()
strFullName = drDataReader("FullName").ToString
strUserName = drDataReader("UserName").ToString
strRoleCode = drDataReader("RoleCode").ToString
[B]userDataString = String.Concat(strFullName, "|", strUserName, "|", strRoleCode)[/B]
Dim authCookie As HttpCookie = FormsAuthentication.GetAuthCookie(txtUserName.Text, chkPersistCookie.Checked)
Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(authCookie.Value)
Dim newTicket As FormsAuthenticationTicket = New FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, [B]userDataString[/B])
Comment