is it possible to login an user automaticaly with razor? On the protected redirect page after member login I have a razor script with this code:
Member m = Member.GetCurrentMember();
var ump = new umbraco.providers.UsersMembershipProvider(); if (ump.ValidateUser(m.LoginName, m.Password)) {
<p>OK</p> } else { <p>ERROR</p> }
This works, but the user is not logged on. I have any members and users with the same loginname and password. I want that the user is automatically logged on when the member logs and the userloginname exist.
thank you. I know the difference between members and users. Apologies that I have not expressed myself correctly.
I try to login on a page with a member. I will then be redirected to a page on which a script is to be called that automatically logs the user of the same name in the backend.
So I only need a snippet for the frontend with razor how I can an user loged on in the backend.
But I have now found another functioning alternative. The reverse is also practical for me: After I logged on in backend I logging on the member in the frontend. In addition I have now created a UserControl for the "welcome dashboard" in backend which automatically logs the member with the same name in the frontend after user logging :-)
Auto User login with razor?
Hello,
is it possible to login an user automaticaly with razor? On the protected redirect page after member login I have a razor script with this code:
This works, but the user is not logged on. I have any members and users with the same loginname and password. I want that the user is automatically logged on when the member logs and the userloginname exist.
Has anyone a snippet or idea to solve this?
Best regards
Sören
This example might help:
Jeroen
Hi Jeroen,
thank you. The ValidateUser works, but it will set no authentication. If I set the redirect to /umbraco/ I'm not logged on.
Sören
Hello,
Are you talking about members of users?
Users can login the Umbraco backend and members in a protected part of the website.
My example is for members.
Jeroen
Hello,
thank you. I know the difference between members and users. Apologies that I have not expressed myself correctly.
I try to login on a page with a member. I will then be redirected to a page on which a script is to be called that automatically logs the user of the same name in the backend.
So I only need a snippet for the frontend with razor how I can an user loged on in the backend.
But I have now found another functioning alternative. The reverse is also practical for me: After I logged on in backend I logging on the member in the frontend. In addition I have now created a UserControl for the "welcome dashboard" in backend which automatically logs the member with the same name in the frontend after user logging :-)
Sören
is working on a reply...