相关疑难解决方法(0)

为什么在Asp.net MVC 2中的子操作中不允许重定向结果

我使用Asp.Net Futures RenderAction方法渲染了一些部分动作.其中一些在处理完表单后执行重定向.

现在我升级到Asp.Net MVC 2 RC它给我一个错误"不允许子操作执行重定向操作".

我检查了源代码,然后找到了抛出异常的行.为了解决这个问题,我可以制作一个自定义的RedirectResult,但在此之前,我想了解为什么框架首先不允许它.必须有一个很好的理由,也许我不应该这样做.

有谁知道这个限制的原因?

谢谢

theory asp.net-mvc asp.net-mvc-2

23
推荐指数
5
解决办法
3万
查看次数

在HTTPS上设置站点后,不允许子操作执行重定向操作

我收到以下错误:

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)

c# asp.net security asp.net-mvc

21
推荐指数
1
解决办法
4万
查看次数

标签 统计

asp.net-mvc ×2

asp.net ×1

asp.net-mvc-2 ×1

c# ×1

security ×1

theory ×1