Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm working on an intranetproject in Umbraco. I use FormAuthentication to login the members. What i want to do is after a member is succesfull authenticated, is to check if there is a user account with the same username as the member and login this backenduser as well.
The member authenticates by Active Directory username and password (via a surfacecontroller).
The memberauthentication works well but I can not get the user authenticated after succesfull authenticating the member.
I have tried to do this with the code below but it doesn't work because when navigating to "/umbraco" the user still gets the loginform.
var user = Services.UserService.GetByUsername(model.Username);
if (user != null)
Culture = user.Language,
Id = user.Id,
RealName = user.Name,
Username = user.Username
When using the code above, there is a cookie created called "UMB_UCONTEXT". Did I forgot something or is there another way to authenticate users programmatically only by username?
Thanks in avance!
The following code should work, it uses the built in Umbraco class 'WebSecurity'.
var ws = new WebSecurity(HttpContext, ApplicationContext);
var user = Services.UserService.GetByUsername("username");
This works great, thanks!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted