views:

16

answers:

1

I want to get the URL of a route using the same syntax as Html.ActionLink, but don't know how to do that from my View.

Is there an HtmlHelper extension that works like ActionLink but returns only the URL?

For instance, I want to write:

<img src="<%= Html.ActionUrl("Image", new { id = 42 }) %>" />
+2  A: 

Check out:

Url.Action()

Aka:

<img src="<%= Url.Action("Image", new { id = 42 }) %>" />
John Gietzen