Ever had a scenario where you'd like to stop the current Response and give an entirely different one?
From ASP.Net 2.0++, you'll have to not only do a Response.End(), but before that a HttpContext.Current.ApplicationInstance.CompleteRequest();
Why? Because Response.End() no longer stops the page processing, so if you, for instance, are sending a file to the response stream, for some reason, it will get the page's HTML in the end of the file's contents.
Special thanks to a post by Rick Strahl, here.
No comments:
Post a Comment