ActionName Attribute & UrlHelper.Action Method in ASP.NET MVC
I use the ActionName Attribute for enabling a dash in the URL:
[ActionName("My-Action")]
public ActionResult MyAction() {
return View();
}
It works fine. But it don't work when I generate links for the navigation-menu:
Link = new UrlHelper(HttpContext.Current.Request.RequestContext).Action(MVC.Area.Controller.MyAction())
The generated Link on the Website is always without the dash.
Does anybody have a solution?
@dime2lo: Thank you for your tip! It works with: .Action("My-Action", "Controller", new { area = "Area"})
上一篇: gcc)当它明显存在时不存在