Using Server.Execute to solve Server.Transfer exception returns two pages
I'm trying to solve the dreaded ThreadAbortException
that happens on Server.Transfer
. I used the technique supplied by Microsoft to use Serve开发者_StackOverflowr.Execute
. The exception is not thrown any more, but after making the server execute, the response seem to append the current page to the "executed" page.
How can I avoid this while using Server.Execute?
this worked well for me and caused no exceptions: HttpContext.Current.Server.Execute("~/ErrorAppDown.aspx", false); HttpContext.Current.Response.End();
That is what Server.Execute()
does. It calls another page just like a method call. And after other page's execution is completed, it starts executing itself. Thus, appending itself after executed page. You have to end response to stop this from happening.
No valid answer seems to be found.
精彩评论