代码如下:
Server.Transfer(Request.QueryString["ReturnUrl"]);
运行时出错信息如下:
[HttpException (0x80004005): 为 /3380324.html 执行子请求时出错。] System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2684 System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +1289 System.Web.HttpServerUtility.Transfer(String path) +146 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
如何解决这个问题?
Response.Redirect 用这个呢
http://stackoverflow.com/questions/2361690/server-transfer-throws-error-executing-child-request-how-to-resolve/12957570#12957570
实际场景无法使用Response.Redirect
@dudu: 那会不会是该页面所处目录的权限问题呢
要跳转到的页面有错才会提示这个错误,找出那个页面的错误就可以了。
看你的写法应该是做url不变的服务端重定向是吧,你用这个HttpContext.Server.Transfer(url, true);试下,不行的话在试试HttpContext.Server.TransferRequest(url, true);这个