0

In ASP.NET,How can i know the Specific details about an exception (like What kind of Exception it is (FileNotFound /Arithmentc etc..) )from a General Exception class object

2 Answers 2

1

You can use GetType() method to get the actual type of the exception instance.

If you are interested in some property of a specific type of exception and you're sure about the type, just cast the exception to the type and fetch the property value.

Alternatively, you can use reflection to interrogate the object and retrieve all of its properties.

Sign up to request clarification or add additional context in comments.

Comments

1

If you need the full details (stack trace, names and such) from an exception object, use the overloaded ToString() on it. It gives quite a lot of information.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.