[NullReferenceException: Object reference not set to an instance of an
object.]
Umbraco.Web.Security.MembershipHelper.IsMemberAuthorized(Boolean
allowAll, IEnumerable'1 allowTypes, IEnumerable'1 allowGroups,
IEnumerable`1 allowMembers) +208
ASP.PageViewsPartialsNavbarcshtml.Execute() in
c:\Development\x.Umbraco\x.Umbraco.Web\Views\Partials_Navbar.cshtml:54
The memberIsLoggedIn var gets set to true.
I say it was working previously - all I have done is added a new member group without touching the existing "HealthcareProfessional" group, and rebuilt the site.
Ok I think I worked out why this is happening, so just fyi for anyone else finding this thread:
The member had previously been logged in and everything had been working. However, someone had deleted the member in the backoffice and this is what caused the ysod.
Now because my browser tab still had the forms auth cookie in place, when I hit F5 the Umbraco.MemberIsLoggedOn() returned true. My guess is that that method simply works off the presence of the forms auth cookie.
And I'm guessing that any null-ref guard code inside IsMemberAuthorized also uses that and then assumes there is a 'current member'. Hence the null ref.
Recycling the app pool didnt fix the error. Only removing the forms auth cookie did.
I could download the source and go through it but unfortunately I dont have the time atm. Maybe Ill revisit it.
Hope the above helps someone with the same problem.
IsMemberAuthorized throwing NullReferenceException
Hi all, Im getting a strange ysod when running some code which previously worked.
IsMemberAuthorized is throwing a NullReferenceException.
The code (in a view) looks like this:
The stack trace is:
The memberIsLoggedIn var gets set to true.
I say it was working previously - all I have done is added a new member group without touching the existing "HealthcareProfessional" group, and rebuilt the site.
Using umbraco v7.4.1
Anyone seen this or have any ideas?
Ok I think I worked out why this is happening, so just fyi for anyone else finding this thread:
The member had previously been logged in and everything had been working. However, someone had deleted the member in the backoffice and this is what caused the ysod.
Now because my browser tab still had the forms auth cookie in place, when I hit F5 the Umbraco.MemberIsLoggedOn() returned true. My guess is that that method simply works off the presence of the forms auth cookie.
And I'm guessing that any null-ref guard code inside IsMemberAuthorized also uses that and then assumes there is a 'current member'. Hence the null ref.
Recycling the app pool didnt fix the error. Only removing the forms auth cookie did.
I could download the source and go through it but unfortunately I dont have the time atm. Maybe Ill revisit it.
Hope the above helps someone with the same problem.
is working on a reply...