MVC: Links to External Sites

Display External Links within a View

Sometimes within a View, a requirement dictates the use of links to sites external to the current project.

Since Html.ActionLink() doesn’t allow for a target to an external site, I satisfied the requirement using the following approach.

First, I stored with each record needing an external link the link properties and retrieved them using LINQ.

Within the view, instead of using the Html.ActionLink(), I used a simple tag with a call to Html.Raw().