获取ASP.NET核心的路线结果
我正在研究一个ASP.NET COE Web API项目。
我有一个 post
方法(路由),我需要它来调用另一个 get
方法:
[HttpGet(Name = "Profile")]
public async Task<ActionResult<ProfileResponseDto>> GetProfile(string username)
如果我致电:
return RedirectToRoute("Profile", new { username = profile.UserName });
我最终将获得 get
resource 。
但是我想要的是采用该 get
方法的结果,然后继续以我的帖子方法。
在python中
amount = requests.get("http://"+catalogIpAddress+":"+port+"/count/" + str(id))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
httpresponse.redirecttoroute方法通过使用路由参数值,路由名称或两者都将请求重定向到新URL,这意味着您无法继续使用最后一个url
httpresponse.redirecttoroute方法,
但是您可以从其他动作结果中返回值,
以便您可以使用类似的结果。这 :
HttpResponse.RedirectToRoute Method Redirects a request to a new URL by using route parameter values, a route name, or both this means that you cannot continue with the last URL
HttpResponse.RedirectToRoute Method
but you can return value from another action result like
so you can use like this :