简体   繁体   English

Server.Transfer不起作用?

[英]Server.Transfer does not work?

I want to redirect to another page using Server.Transfer and I have this simple code: 我想使用Server.Transfer重定向到另一个页面,我有以下简单代码:

if (Page.IsPostBack)
   {
     try
     {
       Server.Transfer("AnotherPage.aspx");
     }
     catch (Exception)
     {                                
       throw ;
     }
    }

But I'm getting an error: "Error executing child request for AnotherPage.aspx.". 但是我收到一个错误:“对AnotherPage.aspx执行子请求时出错。”。 Could not find the solution on the net. 在网上找不到解决方案。

Just to mention, Response.Redirect works flawlessly. 只需提及,Response.Redirect即可正常工作。

The error is likely caused by something in AnotherPage.aspx. 该错误很可能是由于AnotherPage.aspx中的某些内容引起的。 You may want to insert a try... catch handler in AnotherPage.aspx's Load event. 您可能要在AnotherPage.aspx的Load事件中插入try... catch处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM