isloggedon is true but getcurrentmember is null - how?
Hi,
I have a bug whereby working dev code now throws YSODs on the staging site where it thinks that the member is logged on but the member object is null. This is probably best explained in code:
if (umbraco.library.IsLoggedOn())
{
if (umbraco.cms.businesslogic.member.Member.GetCurrentMember() == null)
{
<div>This happens! Member logged on but member is null - how?</div>
}
else
{
<div>Member logged on and there is a member - happy days!</div>
}
}
Can anyone explain how/why this happens and how to fix it? I'm perplexed by how it works as expected locally but not on staging.
if(System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { if(umbraco.cms.businesslogic.member.Member.GetCurrentMember()==null) { <div>This happens!Member logged on but member isnull- how?</div> } else { <div>Member logged on and there is a member - happy days!</div> } }
I've tried this but it does the exact same thing. System.Web.HttpContext.Current.User.Identity.IsAuthenticated is true yet umbraco.cms.businesslogic.member.Member.GetCurrentMember() is null.
The issue is that umbraco.cms.businesslogic.member.Member.GetCurrentMember() should not be true because I'm not logged in. Very odd!
This turned out to be a server-side issue to do with authentication modes; basic authentication was switched on, hence the weird behaviour - the code itself was actually okay.
isloggedon is true but getcurrentmember is null - how?
Hi,
I have a bug whereby working dev code now throws YSODs on the staging site where it thinks that the member is logged on but the member object is null. This is probably best explained in code:
Can anyone explain how/why this happens and how to fix it? I'm perplexed by how it works as expected locally but not on staging.
Umbraco 6.1.6, MVC.
Thanks folks.
Hi dan,
Try this:
Hi Marcio,
I've tried this but it does the exact same thing. System.Web.HttpContext.Current.User.Identity.IsAuthenticated is true yet umbraco.cms.businesslogic.member.Member.GetCurrentMember() is null.
The issue is that umbraco.cms.businesslogic.member.Member.GetCurrentMember() should not be true because I'm not logged in. Very odd!
Any ideas as to what might be causing this?
Thanks,
Dan
I have had the same thing you need to use the ASP Membership.
Thanks Charlie,
This turned out to be a server-side issue to do with authentication modes; basic authentication was switched on, hence the weird behaviour - the code itself was actually okay.
is working on a reply...