Autthenticate user without password
Hi,
I need to authenticate user without its password.
It is like an impersonation.
I am using the following code:
MembershipUser user = _userClientService.GetUserById(new Guid(id));
if (user != null)
UserLoggingReason result = _authenticationService.AuthenticateUser(user.UserName, user.GetPassword());
if (result == UserLoggingReason.Success)
Response.Redirect("/privado/dashboard/index", true);
_userClientService and _authenticationService are wrappers of sitefinity classes.
The problem is that I get an error on user.GetPassword()... Password recovery not enabled...
Thanks.
I edit my own post, this works:
MembershipUser user = _userClientService.GetUserById(new Guid(id));
if (user != null)
User userAuth = new User();
SecurityManager.AuthenticateUser(user.ProviderName, user.UserName, false, out userAuth);
Response.Redirect("/privado/dashboard/index", true);