HttpContext.Current.User.Identity.Name is always string.Empty

FormsAuthentication.SetAuthCookie(tbUsername.Text, true); bool x = User.Identity.IsAuthenticated; //true string y = User.Identity.Name; //”” The problem you have is at this point you’re only setting the authentication cookie, the IPrincipal that gets created inside the forms authentication module will not happen until there is a new request – so at that point the HttpContext.User is in a … Read more