gpt4 book ai didi

asp.net-mvc-3 - url.Action(controller, action) 没有按预期路由

转载 作者:行者123 更新时间:2023-12-04 10:27:54 33 4
gpt4 key购买 nike

在我的 ASP.NET MVC 3 中,我正在使用此代码

<a href=@url.Action("myController", "myaction")>

但是当我点击它时,它不会去我的行动。相反,在 URL 中我看到了这个
http://localhost:1402/?Length=2

我错过了什么吗?

谢谢。

编辑 :

这是我的路线:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

}

最佳答案

第一个参数被解释为 Action

@url.Action("myaction","myController")

关于asp.net-mvc-3 - url.Action(controller, action) 没有按预期路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9535122/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com