我正在使用RedirectToAction(actionName,RouteValue)
重定向到另一个操作,但是它在Microsoft Edge中不起作用,尽管它在所有其他浏览器中都可以正常工作。
控制器具有Authorize属性,但是我在两种方法中都添加了AllowAnonymous。
答案 0 :(得分:0)
尝试使用以下代码来使用RedirectToAction(actionName,RouteValue)方法,该方法在Edge浏览器(44版)中的Asp.net MVC和Asp.net核心应用程序上效果很好。
[AllowAnonymous]
public ActionResult Index()
{
return RedirectToAction("Contact",new { id="1001" , name="AAA"});
}
[AllowAnonymous]
public ActionResult Contact(string id, string name)
{
ViewBag.Message = "Your contact page.";
return View();
}
如果仍然无法正常工作,您遇到任何错误吗?您正在使用什么Edge浏览器版本?您是否可以像Minimal, Complete, and Verifiable example中那样发布足够的代码来重现该问题。
答案 1 :(得分:0)
您尝试使用 RedirectToActionPermanent 方法吗?也许可以解决。
return RedirectToActionPermanent("Contact",new { id="1001" , name="AAA"});