Do you avoid hardcoding URLs (“../”, “~/”, or “/”) and use Url.Action or Html.ActionLink instead?
  v1.0 Posted at 8/03/2013 5:53 AM by Tiago Araujo

Hardcoding URLs in your View can cause problems if your routes or page names need to change. Instead, you should always use the Url and Html helpers to refer to different pages in your MVC application.

<a href="/Rule/Create">Create a Rule</a>
Figure: Bad Example – Hard-coded URLs may lead to broken links if routes change
@Html.ActionLink("Create a Rule", "Create", "Rule")
Figure: Good Example – Use the Url or Html helpers to provide links

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: