IE子操作重定向问题MVC [英] IE Child Action Redirect Issue MVC
问题描述
我们正在开发ASP.NET MVC5一个应用程序。
我试图重定向到一个孩子的行动一些行动(使用RedirectToAction方法)。它在Firefox,但它不能在IE浏览器。
任何想法如何,我可以得到这个与IE浏览器。
We are developing a application in ASP.NET MVC5. I'm trying to redirect to some action(using RedirectToAction method) from a child action. It works in Firefox but it doesn't work in IE. Any idea how i can get this to work with IE.
code:
[ValidateAntiForgeryToken]
[HttpPost]
public ActionResult Create(VehicleGroup vehicleGroup)
{
if (ModelState.IsValid)
{
var cuser = db.Users.Find(User.Identity.GetUserId());
vehicleGroup.User = cuser;
db.VehicleGroups.Add(vehicleGroup);
db.SaveChanges();
ModelState.Clear();
TempData["VG_Create"] = "Vehicle Group saved successfully.";
return RedirectToAction("Index");
}
return PartialView(vehicleGroup);
}
编辑:
其实我有一个索引操作。在索引视图中,我有两个部分。左侧部分显示现有车辆组列表和右部分包含了创建表单(阿贾克斯形式)。
Actually I have a Index Action. In the index view, I have two parts. The left part show the list of existing Vehicle Groups and Right part contains the create form(Ajax Form).
现在,当我创建一个新的汽车集团我将用户重定向到Index操作。不过,这并不在IE浏览器的页面保持不变。虽然在Firefox它重定向,我可以看到新的数据。
Now when I create a new Vehicle Group I redirect the user to Index action. But It doesn't work in IE the page stays the same. While on Firefox it get redirected and i can see new data.
推荐答案
发生在我身上,问题是在IE的兼容模式。
尝试添加下面的_layout
Happened to me, the problem was the compatibility mode in IE. Try to add the following in the _Layout
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
这篇关于IE子操作重定向问题MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!