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 am adding extra properties to a provider created by a colleague. I need the umbhelper to check for memberaccess to a resultpage in a search. Unfortunately i get an "value cannot be null" on the "public UmbracoHelper umbHelper = new UmbracoHelper(UmbracoContext.Current);" line.
How should i instantiate the helper so i can use it properly?
Eternally grateful for any help possible.
Solved. I moved the instantiation inside the CreateObject class.
Just one thing that may be useful: it seems that your CreateObject method is already being passed an instance of the UmbracoHelper (see the helper parameter).
So you can probably just use that by changing that line as follows:
bool restricted = umbHelper.IsProtected(result.Path)
bool restricted = helper.IsProtected(result.Path)
and then just remove the umbHelper instantiation and property altogether.
That's probably a better way of doing it, because creating instances of UmbracoHelper from UmbracoContext.Current is discouraged:
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted