how can i return current.umbracohelper in umbraco-v9
Hi.
I have the following code which does not work in umbraco v.9:
public static UmbracoHelper GetUmbracoHelper() {
if ( HttpContext.Current != null ) {
return Current.UmbracoHelper;
}
return null;
}
What I have done:
public UmbracoHelper GetUmbracoHelper()
{
if (_accessor.HttpContext != null)
{
return _umbracoHelper;
}
return null;
}
So I have injected UmbracoHelper but iam getting error that says "AssignedContentItem = '_umbracoHelper.AssignedContentItem' threw an exception of type 'System.InvalidOperationException'" Do someone know what I am doing wrong or missing ?
what exactly were you planning on using umbracohelper for exactly? I believe there are other ways of achieving it in your classes rather than using umbraco helper
how can i return current.umbracohelper in umbraco-v9
Hi.
I have the following code which does not work in umbraco v.9:
What I have done:
So I have injected UmbracoHelper but iam getting error that says "AssignedContentItem = '_umbracoHelper.AssignedContentItem' threw an exception of type 'System.InvalidOperationException'" Do someone know what I am doing wrong or missing ?
what exactly were you planning on using umbracohelper for exactly? I believe there are other ways of achieving it in your classes rather than using umbraco helper
Hi Fa
There is a good article here about how to access UmbrocoHelper and UmbracoContext in various different places in v9 that might be helpful
https://our.umbraco.com/documentation/implementation/Services/
Hi Marc Goodson
The article was helpful, it did resolve the issue i had. Thank you :)
is working on a reply...