I am thinking about getting the usernames of my site using this in my opinion (Razor syntax):
@MySite.Helpers.Utils.UserName
heres utils class:
public class Utils
{
static FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
public static string UserName { get { return id.Ticket.UserData; } }
}
Are there any potential issues with this code?
The reason I'm doing this is because Im going to store the username in the userdata field of the new FormsAuthenticationTicket when the user logs in.
I treat it like this because I use facebook connect and want to save the ID there in the username field in db and their names / full names in a separate table.
facebook -. Im , , userdata .
, , : @MySite.Helpers.Utils.UserName
? ?
? ?