返回页面状态为JSON

时间:2019-03-05 09:10:46

标签: asp.net-core asp.net-core-mvc

除了将当前页面作为return this.Page()返回之外,我还需要将其作为带有返回URL的JSON返回-类似于return new JsonResult(new { redirectUrl = Url.Page(this.Page()) });

这可能吗?

2 个答案:

答案 0 :(得分:0)

我找到了-return new JsonResult(new { redirectUrl = this.Url })

答案 1 :(得分:0)

您可以使用此:

  return Json(new {redirectUrl = this.Url});