Solved

.Net exception for System.Net.WebClient

Posted on 2013-11-29
1
586 Views
Last Modified: 2013-11-29
I want to test if my codes can catch as many possible exception as it can in try-catch block.
In order to do that, I need to know what is the list of exceptions can be raised by using a particular class.
For example, when I use System.Net.Webclient, what exceptions can be raised? in MSDN, I can find any list of possible exceptions for a specific class I use.
In more specific, when I create an object system.net.webclient, what excpetions are thrown with the constructor?
And when I use methods of the class, what exceptions are thrown?
How do I know what list of exceptions can be thrown for constructor and methods?
0
Comment
Question by:crcsupport
1 Comment
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
Hi crcsupport;

Microsoft documents each exception that can be thrown by methods of a class. To see these exceptions goto the documentation and see the section in the method called Exceptions. For example if you what to know what exceptions the function WebClient.OpenRead(Uri) goto your browser and make a search on, WebClient.OpenRead .Net MSDN, note that I placed .Net MSDN at the end, I found out by doing this what I am looking for on the Microsoft site always is shown first or within the first couple of lines. So when I placed WebClient.OpenRead .Net MSDN in Google search bar in the result it was the second on the list. When I followed the link I looked for the section on Exceptions and found that it is programed to throw two types of exceptions, ArgumentNullException and WebException. Now that does not mean that while that methods is being executed it will not throw some other types of exception which is from the code that you have placed there so you need to be aware of what other exception can be thrown from that code by looking it up as well.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now