1.Generating Outgoing URLs in Views
Rules:
routes.MapRoute("MyRoute", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); }
View:
-
<div> @Html.ActionLink("This is an outgoing URL", "CustomVariable") </div>
Html:
<a href="/Home/CustomVariable">This is an outgoing URL</a>
routes.MapRoute("NewRoute", "App/Do{action}", new { controller = "Home" });
Html:
<a href="/App/DoCustomVariable">This is an outgoing URL</a>
2.Generating Outgoing URLs in Views
It's not a link, just a literal string.
@Url.Action("Index", "Home", new { id = "MyId" })