In the same way that I can create an ActionLink in ASP.NET MVC that points to an action in a controller (e.g. – @Html.ActionLink("MyDisplayText", "MyAction", "MyController")), I would like to be able to create a hyperlink with an explicitly-defined, external url.
What I’m looking for is some code like @Html.HyperLink("stackoverflow", "http://www.stackoverflow.com/") that generates this HTML: <a href="http://www.stackoverflow.com/">stackoverflow</a>
If this isn’t possible, I can always just write the HTML by hand.
(This is my first stackoverflow question. How exciting.)
A custom helper could look like this:
May this be the first of many custom HtmlHelpers you use!