Server.Transfer throws Error executing child request. How to resolve?
I found an alternative to Server.Transfer() I used HttpContext.Current.RewritePath(“somefile.aspx”); This solved the issue.
I found an alternative to Server.Transfer() I used HttpContext.Current.RewritePath(“somefile.aspx”); This solved the issue.
This exception is throw by the call to Server.Transfer in order to halt the execution of the current method – exactly the same thing gets thrown if you do Response.Redirect. The two choices you have are: Catch and rethrow the ThreadAbortException / reperform the Server.Transfer Make sure that you only do Server.Transfer in places where … Read more
How about a TransferResult class? (based on Stans answer) /// <summary> /// Transfers execution to the supplied url. /// </summary> public class TransferResult : ActionResult { public string Url { get; private set; } public TransferResult(string url) { this.Url = url; } public override void ExecuteResult(ControllerContext context) { if (context == null) throw new ArgumentNullException(“context”); … Read more
Response.Redirect simply sends a message (HTTP 302) down to the browser. Server.Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.