ASP.NET Core MVC中的路由
如何在URL中创建这样的路由,
Localhost:4578//Home/Index/1/2/3/4/5/6
我尝试使用ASP.NET Core 3.1 MVC中的路由来制作自定义URL。
How can I create a route like this in the url
Localhost:4578//Home/Index/1/2/3/4/5/6
I tried making a custom url using routing in ASP.NET Core 3.1 MVC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您不能在端口号之后使用双重斜杠,
想象一下,您有一个类别controller,
其类名称将是这样
,在此之后,您将拥有返回ActionResult的方法或此控制器中的其他内容,
您可以通过使用 /admin /category访问此方法/上类别/add
,如果要使用ID或类似的内容,
则应在其上使用{id}
First you cannot use double slash after your port number,
Imagine, you have a CategoryController
Its class name will be like this
and after that you will have a method returning ActionResult or something else in this controller
You access this method by using /admin/category/upper-categories/add
and if you want to use an id or something like that
you should use {id} on it