I have a site with an admin area and I have created a HTML Helper to help me create images of different sizes in my views, with the following.
Html.Image<ImageController>(c => c.DisplayImage(img.Filename, 53, 35), "Product Thumbnail")
This is my helper,
public static string Image<T>(this HtmlHelper helper, Expression<Action<T>> action,string alt) where T : Controller
{
string url = LinkExtensions.BuildUrlFromExpression(helper, action);
return string.Format("<img src=\"{0}\" alt=\"{1}\" />", url, alt);
}
The problem I am having is the line string url = LinkExtensions.BuildUrlFromExpression(helper, action);
is adding the admin area to the url.
Eg http://localhost:57771/Admin/Image/DisplayImage?....
Instead of http://localhost:57771/Image/DisplayImage?....
I believe it is related to this reported issue, but the workaround submitted is not compiling for me. Not sure where to go from here, any help would be great.