我使用Asp.Net Futures RenderAction方法渲染了一些部分动作.其中一些在处理完表单后执行重定向.
现在我升级到Asp.Net MVC 2 RC它给我一个错误"不允许子操作执行重定向操作".
我检查了源代码,然后找到了抛出异常的行.为了解决这个问题,我可以制作一个自定义的RedirectResult,但在此之前,我想了解为什么框架首先不允许它.必须有一个很好的理由,也许我不应该这样做.
有谁知道这个限制的原因?
谢谢
我收到以下错误:
Child actions are not allowed to perform redirect actions.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Child actions are not allowed to perform redirect actions.
Source Error:
Line 1: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<RenderActionViewModel>" %>
Line 2: <%Html.RenderAction(Model.ActionName, Model.ControllerName, Model.RouteValues); %>
Line 3:
The Stack trace is:
[InvalidOperationException: Child actions are not allowed …Run Code Online (Sandbox Code Playgroud)