?
Solved

Difference between exception and httpexception

Posted on 2009-02-24
6
Medium Priority
?
622 Views
Last Modified: 2012-06-27
Hi,

What is the difference between the following:

Throw New Exception("test")
Throw new httpException("test")

Is there any difference in output to the stacktrace/exception details and such?
0
Comment
Question by:Onthrax
  • 3
  • 3
6 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 23720523
The HttpException class is an HTTP-specific exception class that enables ASP.NET to generate exception information. For more information about throwing and handling exceptions, see Handling and Throwing Exceptions.

I don't think that there will be a difference in the stacktrace details
0
 
LVL 13

Author Comment

by:Onthrax
ID: 23720575
I have read (most parts) of the article.

As far as I can tell the httpexception has the exception base class. But what is the added value of the httpexception in regard to the exception class?
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 23720617
It's better to catch the correct exceptions instead of the general exception (see the part of exception handling)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Author Comment

by:Onthrax
ID: 23720660
I'm sure it is.. but I can't seem to find what the added value of the httpexception is. I would like to know this.
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 23720677
As far as I see it, it's easier to know what the reason of the exception is. If you always catch the general exception, you can't do anything with it.
While if you know for example that you can get a System.IO.IOException you can inform the user that there was an error with the file that he wanted to read, write, ... and let the program continue. Whenever another exception occurs, you really want to quit the program
0
 
LVL 13

Author Comment

by:Onthrax
ID: 23720746
You got a point there. I think I'll leave it at that. Thank you for the insight.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question