Error executing child request for

狂风中的少年 提交于 2019-12-22 10:23:16

问题


In my MVC3 application I'm getting the above mention error when I try to handle a maximum request exceeded error.

I'm handling the exception at the application level. I'm trying to redirect to an error page that's located in the Shared folder of the views.

I'm using the code below to redirect to an error page if the request size is over the limit.

 this.Server.ClearError();
 this.Server.Transfer("~/Views/Shared/NotAuthorised.cshtml");

This is the error im getting.

Error executing child request for /SiteName/Views/Shared/NotAuthorised.cshtml


回答1:


According to the Microsoft documentation (Error Executing Child Request" Error Message When You Use Server.Transfer or Server.Execute in ASP.NET Page) you cannot use Server.Transfer after an application level error.

Microsoft Internet Information Services (IIS) dispatches the Server.Transfer or the Server.Execute request to the appropriate Internet Server Application Programming Interface (ISAPI) extension based on the extension of the requesting file. For example, a request for an .aspx page is dispatched to the Aspnet_isapi.dll ISAPI extension.

After the request is dispatched to appropriate ISAPI extension, the ISAPI extension cannot call another ISAPI extension. You receive the error message that is listed in the "Symptoms" section because the Aspnet_isapi.dll file, which handles requests to ASP.NET pages, cannot forward the request to the Asp.dll file, which handles requests to ASP pages.

You can however use Response.Redirect(path) like this:

Response.Redirect("Home/About");


来源:https://stackoverflow.com/questions/13343960/error-executing-child-request-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!