Thursday, November 25, 2004

Internals of ‘Response.Redirect’

We use Response. Redirect to redirect to another webpage. Sometimes it throws ‘”Thread was being aborted” message.

This might be because the page is executing by a thread on which worker process contains. And on some line in our code, an instruction (Response.Redirect) wants to stop the execution because it must be stopped and framework must be notified about a redirection request. framework catches the Redirect method’s exception, aborts the thread and uses a new thread for execution of to be redirected page.

This occurs when you specify the second argument of Redirect method as True. Because this means to framework as 'Stop this page's execution ASAP and execute to be redirected page'.

This exception is raised because Response.Redirect method internally calls Response.End method which raises this exception and the page processing terminates. Response.End raises this exception indirectly through calling Thread.Abort which raises this exception directly.

Another thing we can do is use the overloaded version of Redirect:

Response.Redirect("default.aspx", false);

Happy programming

WrvOxo [url=]Moncler Outlet[/url] JllLky

GfoFcj [url=]Nike Free V2[/url] KxiAys

BvhAgu [url=]Moncler Piumino[/url] GyuLni

ShoEsa [url=]Canada Goose Canada[/url] VppScg

UmmJam [url=]Canada Goose Jakker[/url] HpqAyx

KuhXkq [url=]Canada Goose Jakke[/url] XvzKiz

UfqRpi [url=]Goose Jakker[/url] OxeIba
Post a Comment

This page is powered by Blogger. Isn't yours?