编程语言
首页 > 编程语言> > c# – Mvc 5属性路由

c# – Mvc 5属性路由

作者:互联网

我正在尝试使用Mvc 5附带的内置属性路由,之前我在Nuget上使用了AttributeRouting包.

但是如何通过指定路由是否为Get或Post请求来设置路由?

在AttributeRouting中有GET()和POST()属性,但在Mvc 5中只有一个Route()属性?

解决方法:

您仍然可以在MVC5中使用PostAttribute,它完全受支持.

“The earlier style of routing, called convention-based routing, is
still fully supported. In fact, you can combine both techniques in the
same project.”

source

标签:c,asp-net-mvc,asp-net-mvc-routing,asp-net-mvc-5,attributerouting
来源: https://codeday.me/bug/20190629/1324900.html