ThreadAbortException in Response.Redirect

27 04 2011

If you ASP.Net application has catch all error logging, don’t be surprised if you find ThreadAbortException [Exception message: The thread was being aborted] very often. The culprit could be the following code.

try

{


//Some error thrown


throw
new
DivideByZeroException();

}


catch (Exception ex)

{


//Some logging code here


//Finally redirect user to error page

Response.Redirect(“Error.aspx”,false);

}

The reason is that Response.Redirect end the current response by calling Response_End internally. Response_End always throws a ThreadAbortException by design. To avoid this you can do either of the following

  1. Catch the ThreadAbortException and call Thread.ResetAbort to cancel the abort. Do keep in mind that there is no guarantee that the thread will ever end.
  2. Ignore it. Which means, catch the exception; but do not log it.
  3. Finally, Response.Redirect takes two paramters. The URL itself and a Boolean parameter telling whether the current response should end or not. To avoid ending the current response, pass a Boolean value of false. So we can rewrite the above code as

    Response.Redirect(“Error.aspx”,false);





Secondlife: Parody

23 06 2007

If you have been in Secondlife, the virtual world even for a minute; you would get what this video is all about. Really funny. :) 





25000 views!!!

23 05 2007

The blog has successfully completed 25000 views. Thankyou readers!!!





Is religion fading in todays youth?

9 05 2007

Yesterday a friend of mine happened to ask me an interesting question over gtalk. She wanted to know my opinion on whether today youth have time for religion? I had just watched Babri Masjid demolition documentry the night before and was in a kind of confused state as to what she meant. You know the question came at the most unexpected time that too during a casual chat. Personally I feel that todays youth does have time for worship, but its just that it is not in their highest priority list. People pray only when they are in trouble, not all, but most of them <no offence>. Take the case of students, you could see them running to places of worship on the day of exams, sad to say I used to do the same some years ago. 

After that she asked me whether I believe in god. Well, for this question I always have a stable answer. I dont believe in god, but I do believe that a superpower exists. I dont give it any shape or size, but I know it exists. From the time you are born, you are brought up with the idea that god exists and he will help you at the time of distress. Gradually there is a mental phenomenon associated with the feeling that god would help during time of distress. Its the same feeling that gives us strength and support when we pray. God created men and men created religion. In a way China is best where religion is banned… there is no question of communal violence at all.

Sometimes when bad things happen people tells me that its fate, and when good things happen… its luck :). I always tell them that I dont believe in fate. Just because I dont like the idea that I am not in control of my life. If eveything is predefined as to what is going to happen next, then whats the meaning of life? I dont know, but I chose the way I want to live, its not been written anywhere. I belive its us that write our future… think good and you will attract good towards you. Think bad and you will suffer. Its all the power of belief.

Have you read the book, The Magic Of Thinking Big by  David Schwartz? If not do read it. Its one of the best books I have ever read. It has changed my life by shaping me into a better person, hope it does the same to you too. oh before I stop let me tell a fact. My friend happens to be doing internship at Deccan Chronicle and she said my opinions might come up in one of the opinions colums of Deccan. :D

Alright, thats for today. Between do let me know about what you think about religion!!!





The 100th Post!!!

7 05 2007

100th PostWhen I started writing this blog during Blogcamp Chennai, I was never sure as to how much time I could dedicate for blogging. The odds were against me and after I left for Microsoft India Development Centre at Hyderabad in September end, I no longer found enough time (er…. to be short lazy enough) to blog. After a long span, I am back to blogging and its good to see that I am writing my 100th post and at this point of time my blog statistics are

Blog Stats

Total Views: 22,022

Best Day Ever: 442

Views today: 17

Totals

Posts: 99

Comments: 167

Tags: 14

Good to see that there has been over 22000 views for a 100 post blog. Thank you very much people. Within a month or two you can see increased activity when my exams get over and then you could also see live blogging on The Knowledge Foundation events like Proto.in SE, Podworks etc. Oh and yes, I have been to Mobile Monday (on a sunday :) ) yesterday and will soon write about it. Keep visiting…





360 Degree Interactive… is now hiring

2 05 2007

360 Degree InteractiveWhy am I writing about a job oppurtunity in my blog? Interesting question. Well I have a kind of personal attachment with  this company. It was a year and a half back when I was in 3rd year that I met Mr. Narain, CEO of 360 Degree Interactive at TracBacBarcamp Chennai. It was Narain who introduced a normal kid to the corporate world. There I learned what it takes to be competent. Getting introduced to him and the company was one of the best things that have happened in my life so far. Wait until I make the list of top 10 influential people of my life (probably after my exams).

Now about the company,

“360 Degree Interactive (3DI) is a Web Services company. We are small, agile and passionate about what we do. We believe in an “on-demand world with on-demand solutions”.

We help organizations utilize the web services effectively, powerfully and provide end-to-end solutions to their users. We believe Web as a platform for all communication & application needs for the world. We work with Web standards and emerging technology standards [Microformats, RSS, XML-RPC, OpenID, APIs] to deliver people oriented next generation solutions & services.

3DI was started in 2003 in Chennai, India, by three technopreneurs.”

And about the job I was talking about… this is an interesting job ad that you would never find anywhere. Not event in Google. Check it out at www.360in.com. Also do check out their product, TracBac. The job ad is as follows:

“We are not looking at M.Phil, Ph.D guys. We are looking at passionate coders, who love to code on RoR, Actionscript 2.0 / 3.0 & eat MySQL queries for Lunch, you are welcome. We are also looking for people, who can tangle XHTML, CSS, WordPress, tWiki for their late nite dinner. Never worry about education, the founders themselves are drop outs. Shoot a mail to balaji at 360in.com by answering a simple question – Why you want to be a coder & work for a Web 2.0 firm ?”

Now dont you think thats interesting? If you feel that you are passionate about technology, do mail balaji at 360in dot com with the simple answer which you would definitely have if you are really passionate about it. All the best!!!





Jimmy Wales with me

25 02 2007

Hey, guess with whom I posed for photograh. Yup, thats right! Its Jimmy Wales himself!!! Thats Aswin of Sasken, Prathul (Myself) and Jimmy Wales (founder of Wikipedia)!!!

Myself, Jimmy Wales & Aswin








Follow

Get every new post delivered to your Inbox.

Join 492 other followers