I'm currently struggling in a problem where I need to register a route like:
https://localhost:44300/oneController/{Guid}/method1?param1=10000¶m2=stuff
What I've tried was something similar to this:
[HttpGet]
public async Task<ActionResult> method1(Guid id, int param1, string param2)
{
...
}
However, this does not seems to work, any ideas to resolve this issue?
You can use RouteAttribute
, like
[Route("{id:guid}/method1"), HttpGet]
public async Task<ActionResult> method1(Guid id, int param1, string param2)
{
...
}
Good to read MSDN Documentation: Attribute Routing in ASP.NET
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.