Wednesday, October 24, 2007

Thread aborted while response.redirect. ASP.NET

Thread was being aborted - Response.Redirect or Server.Transfer Yesterday I was working with the maintenance of a project that was working fine. After the required changes in the code, my team mate did the unit testing. At that time she found that at some point the application throws an error message "Thread was being aborted". The same code was working fine earlier and we didn't expect that error there. She started to debug and found that the error is thrown from a Server.Transfer() call. However the code was there in the previous version and it was working. Our eyebows became more curved and forehead with wrinkles.
As I couldn't solve the problem in the first look, I decided to revert the code and test. Yes.. it is working. The main change what we had done was to take out the user interaction of that page and the required values came to this page as query string. I had a button clik event earlier. The code resided in that event is now (by the change) is called from the Page.Load event. I understood that the reason is that we are calling this method from the Page_Load(). But we have to do that.
So the next step is to do some googling. What I got is the information from Microsoft that this is by design. They suggested to use Server.Transfer("page", false) or Response.Execute(). But I was not ready to change my worked code. I started to do "comment and uncomment" debugging method to find tha actual villain. At last I found.

In my code Page_Load(), there was a line in the beginning "Session.Abandon()". I used this line of code to release the session when the user logged out from the application. When I commented that line my application worked with the the new code. I am happy, but I have to think about the reason behind it. I will tell later.

Wednesday, October 17, 2007

Introduction

I wonder all days, in the morning, mid-day, evening or in the night. What all the new information we gather all days! How many new faces, we see! Many kind of people we met! Even if it is an ordinary gray day. Yes! There are new... A lot of, a host of new....

I am working in the field of Information Technology. Life as a software engineer. Hectic, but enjoying.
One day I thought that I will write all the new information I get every day some where. Started to think long back. Years! And now comes my first blog. The introduction.