简体   繁体   中英

Server.Transfer does not work?

I want to redirect to another page using Server.Transfer and I have this simple code:

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

But I'm getting an error: "Error executing child request for AnotherPage.aspx.". Could not find the solution on the net.

Just to mention, Response.Redirect works flawlessly.

The error is likely caused by something in AnotherPage.aspx. You may want to insert a try... catch handler in AnotherPage.aspx's Load event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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