C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Errors and Solutions » General »

Response.Redirect raises ThreadAbortedException


Posted Date: 16 Sep 2009    Resource Type: Errors and Solutions    Category: General
Author: Sudeep SyamnathMember Level: Silver    
Rating: 1 out of 5Points: 4



Error

While using Response.Redirect("url") a ThreadAbortedException is raised. Due to this error, whatever code is written after Response.Redirect("url") will not execute

Reason

Response.Redirect("url") internally invokes Response.End() which aborts the current thread. This causes the ThreadAbortedException

Solution

Response.Redirect has another overload which takes a boolean value as second parameter other than the url as the first parameter. The boolean value depicts whether to end the current response or not. If false is passed then the current response is not ended.

After this the application instance of the current context can be accessed and the request can be completed.

Code

Response.Redirect("url",false);
HttpContext.Current.ApplicationInstance.CompleteRequest();

Best Regards,
Sudeep Syamnath



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Thread aborted exception in Response.Redirect  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: MS SQl server as project prerequisite installation error
Previous Resource: Ajax Tool kit not working
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use