The Exception Class

very exception class derives from the base class System.Exception.The .net Framework is full of predefined exception classes, such as NullReferenceException, IOException, SqlException, and so on. The Exception class includes the essential functionality for identifying any type of error. Here we will see some of the most important members in ASP.NET.very exception class derives from the base class System.Exception.The .net Framework is full of predefined exception classes, such as NullReferenceException, IOException, SqlException, and so on. The Exception class includes the essential functionality for identifying any type of error. Here we will see some of the most important members in ASP.NET.
Member DescriptionHelpLink It describes a link to a help document, which can be a relative or fully qualified uniform resources locator(URL) or uniform resource name (URN).The.NET Framework does not use this property, but you can set it in your custom exceptions if you want to use it in your web page code.InnerException It describes a nested exception. For example, a method might catch a simple file input/output (IO) error and create a high level “operation failed” error. The details about the original error could be retained in the InnerException property of the higher level error.Message it describes a text description with a sufficient amount of information describing the problem.Source It describes the name of the application or object where the exception is raised.StackTrace it describes a string that contains a list of all the current method calls on the stack, in the order of most recent to least recent. This is useful for determining where the problem occurred.TargetSite it describes a reflection object (an instance of the System.Reflection.MethodBase Class) that provides some information about the method where the error occurred. This information includes generic method details such as the method name and the data types for its parameter and return values. It does not contain any information about the actual parameter values that were used when the problem occurred.GetBaseException() it describes a method useful for nested exception that may have more than one layer. It retrieves the original exception by moving to the base of the InnerException Chain. When you catch an exception in an ASP.NET page, it would not be an instance of the general System.Exception.Class.Instead,it will be an object that represents a specific type of error .This object will be based on one of the many classes that inherit from System.Exception.These include diverse classes such as Divide By Zero Exception, Arithematic Exception, IO Exception, Security Exception, and many more.
Visual Studio provides you a useful tool to browse through the exceptions in the .NET class library.
Just select Debug Tab —> click Exception from the menu,to do this you will need to have a project open.The Exceptions dialog box will appear. Expand the Common Language Runtime Exceptions group, which shows a hierarchical tree of .NET exceptions arranged by namespace.
Fig 1.
The Exceptions dialog box allows you to specify which exception should be handled by your code when debugging is performed and which exceptions will cause Visual Studio to enter break mode. Which means that you do not need to disable your error-handling code to troubleshoot a problem?
For Example, you could choose to allow your program to handle a common FileNotFoundException (which could be caused by an invalid user selection) but tell Visual Studio to pause exception if an unexpected DivideByZeroException occurs.
To set this setting, add a check mark in the Thrown column next to the entry for the System. DivideByZeroException. This way, you will be alerted as soon as the problem occurs.

Scroll to Top