2015-02-17から1日間の記事一覧

ASP.NET MVC 5 のコントローラーでアクションの URL を作成する

C#

コントローラーでも UrlHelper を使ってアクションの URL を作成できたのでメモしておく。 var helper = new UrlHelper(ControllerContext.RequestContext); var indexPath = helper.Action("Index", "Home"); // => / var indexUrl = helper.Action("Index"…