Routing Issue When Using Url.action
All, I have the following route/action defined on my controller : [RoutePrefix('widgets/download-functions')] [Route('download/{publishedReportId}'), HttpGet] public ActionResult
Solution 1:
If you are using Url.Action, it doesn't take advantage of attribute routing, you will need to follow the original method of routing, which is to use, Action, Controller, area and params to get the extension method to produce the url.
[RoutePrefix("widgets/download-functions")]
publicclassWidgetDownloadController : Controller
...
[Route("download/{publishedReportId}"), HttpGet]
public ActionResult Download(int publishedReportId)
You would get a Url.Action like:
console.log("@(Url.Action("Download","WidgetDownload", new { publishedReportId = 9999 }))");
Also, this will only work on scripts that are parsed by the razor engine, ie. scripts that are written directly in the view.
Post a Comment for "Routing Issue When Using Url.action"