Rest Extension in Umbraco 7.6 HttpContext.Current.User is returning umbraco user not current member?
We're using Active Directory for membership and in a Rest Extension when calling HttpContext.Current.User it is returning the currently logged in umbraco user rather than the currently logged in member..
I was wondering if anyone else had experienced this?
in a razor view using @Membership.GetUser().UserName it returns the logged in member
if I do this in code:
[RestExtension("InductionHelper")]
public class InductionHelper
{
[RestExtensionMethod(ReturnXml = false, AllowAll = true)]
public static string RegisterPolicyAgreement()
{
var memberName = Membership.GetUser().UserName;
var someRandomVarName = ApplicationContext.Current.Services.MemberService.GetByUsername(memberName);
Membership.GetUser() is querying based on the currently logged in umbraco admin user in our override of get user:
public class CustomMembershipProvider : ActiveDirectoryMembershipProvider
{
public override MembershipUser GetUser(string username, bool userIsOnline)
{
if (!string.IsNullOrWhiteSpace(username))
{
var result = (MembershipUser)HttpContext.Current.Session[username];
if (result == null)
{
result = base.GetUser(username, userIsOnline);
HttpContext.Current.Session[username] = result;
HttpContext.Current.Session["recentUser"] = username;
}
return result;
}
else
{
return null;
}
}
}
Rest Extension in Umbraco 7.6 HttpContext.Current.User is returning umbraco user not current member?
We're using Active Directory for membership and in a Rest Extension when calling HttpContext.Current.User it is returning the currently logged in umbraco user rather than the currently logged in member..
I was wondering if anyone else had experienced this?
in a razor view using @Membership.GetUser().UserName it returns the logged in member
if I do this in code:
Membership.GetUser() is querying based on the currently logged in umbraco admin user in our override of get user:
is working on a reply...