I am trying to generate an url for an MVC 3 action within javascript environment (in a cshtml file).
var src = "@Html.Raw(Url.Action("GetProductImage", new { productId = Model.Product.Id, pos = 1, size = 0 }))";
Url.Action worked for me not HtmlUrl.Action
Enjoy!