MVC3 中的区域 - RedirectToAction 未按预期工作
我有一个名为覆盖范围的区域。路由就像
context.MapRoute(
"CoverageSummary", // Route name
"Coverage/Summary/{policyId}", // URL with parameters
new { controller = "Coverage", action = "Summary", policyId = UrlParameter.Optional }, // Parameter defaults
new string[] { "Web.Mvc.Claims.Areas.Coverage.Controllers" }
);
当我访问页面 Mysite/Coverage/Summary/10 时它会显示一个页面。美好的。 但在 Action 方法中,我有如下代码
return RedirectToAction("Summary","Coverage", new RouteValueDictionary(new { policyID = 10 }));
,但这不会加载页面 Mysite/Coverage/Summary/10 。 它显示 404 错误。 如果我刷新页面,它仍然给出 404。但是如果我在地址栏中剪切并粘贴相同的网址,然后按 Enter 键,它就可以工作了,
这可能是什么原因
I have an area called coverage.The routing is like
context.MapRoute(
"CoverageSummary", // Route name
"Coverage/Summary/{policyId}", // URL with parameters
new { controller = "Coverage", action = "Summary", policyId = UrlParameter.Optional }, // Parameter defaults
new string[] { "Web.Mvc.Claims.Areas.Coverage.Controllers" }
);
when I acess the page Mysite/Coverage/Summary/10 it shows a page. fine.
But in an Action methode i have code as below
return RedirectToAction("Summary","Coverage", new RouteValueDictionary(new { policyID = 10 }));
but this is not loading the page Mysite/Coverage/Summary/10 .
it is showing 404 error.
if i refresh the page still it give 404.but if i cut and past the same url in address bar and hit enter it works
What can be the reason
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 RouteValueDictionary 中使用区域属性
Try with area property in your RouteValueDicitionary