今天突然遇到这个问题。
百度了好多都是下这个模板
- 1、直接Redirect后加 Controller/Action
- Response.Redirect("/User/Edit");
- // return Redirect("/User/Edit");
- return RedirectToAction("about","Home");
- Response.Redirect("/User/Edit");
但是从来就没有人说清楚RedirectToAction哪里来的。。真是坑啊
后面发现下面方法,亲测可用
public ModelAndView controllA()
{
return new ModelAndView("redirect:xxxx");
//xxxx为本controller中的另一个方法,例如redirect:mine-reply;p=test?userId=2
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步