The GetCropUrl() method is an extension method in the Umbraco.Web namespace, so you'll need to include that (if it's not already). So if you are calling it from a view (template) then you'd need to add:
@using Umbraco.Web
Also, what are the parameters you are passing to the method? If you call it with parameters it doesn't understand then you can get this type of error.
OK, cool, but you definitely can't use @Umbraco.Web since @Umbraco in this instance would be the UmbracoHelper class rather than the namespace (unfortunately Umbraco calls the property that is exposed in templates @Umbraco, which causes confusion with the namespace of the same name).
So it sounds like you have a config error. What I'd do is download the zip file from https://our.umbraco.com/download/releases/7124 and then compare your web.config with the one in there. In particular, compare the web.config in your /Views/ folder, as this is where MVC references get added.
I just checked it. Except of the slimsy-entry, the web.config in the /views folder are identical. All reference in the main web.config are also identical.
I have no idea anymore...
Url.GetCropUrl CS1973: 'System.Web.Mvc.UrlHelper' has not such method
Hi,
I just wanted to use slimsy in my umbraco instance (Version 7.12.4). But it throws an error, when I want to use @Url.GetCropUrl.
The error says: Url.GetCropUrl CS1973: 'System.Web.Mvc.UrlHelper' has not such method
Any idea?
Thanks to all who read...
The
GetCropUrl()
method is an extension method in theUmbraco.Web
namespace, so you'll need to include that (if it's not already). So if you are calling it from a view (template) then you'd need to add:Also, what are the parameters you are passing to the method? If you call it with parameters it doesn't understand then you can get this type of error.
Generally you need to pass it an image of type
IPublishedContent
as the first parameter. See https://our.umbraco.com/Documentation/Getting-Started/Design/Rendering-Media/When I include "@using Umbraco.Web", I still get the same error. When I call it before the @Url like this:
I got this error:
Umbraco.Web.UmbracoHelper' does not contain a definition of 'Web'
I guess, I missed some web.config References during an older update maybe?
Hi,
Try calling it like:
rather than:
This was my initial call. :) That throws the error with the System.Web.Mvc thing...
Apart from adding the following namespaces...
... did you also create an instance of the UrlHelper? For instance:
More details here:
https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.urlhelper?view=aspnet-mvc-5.2
https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Web.UrlHelperRenderExtensions.html
OK, cool, but you definitely can't use
@Umbraco.Web
since@Umbraco
in this instance would be theUmbracoHelper
class rather than the namespace (unfortunately Umbraco calls the property that is exposed in templates@Umbraco
, which causes confusion with the namespace of the same name).So it sounds like you have a config error. What I'd do is download the zip file from https://our.umbraco.com/download/releases/7124 and then compare your
web.config
with the one in there. In particular, compare theweb.config
in your /Views/ folder, as this is where MVC references get added.I just checked it. Except of the slimsy-entry, the web.config in the /views folder are identical. All reference in the main web.config are also identical. I have no idea anymore...
is working on a reply...