Avatar of keith1001
keith1001
Flag for United States of America asked on

Visual basic .net - Try Catch Ex.Exception get actual error number

I have the following below and it shows a message like
404 not found
401 not authorized

How would I just get the error number?

Catch ex As WebException
            MsgBox(ex.Message)
Visual Basic.NET

Avatar of undefined
Last Comment
Paul Jackson

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
rawinnlnx9

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Paul Jackson

You could use the err object instead that gives err.number but I don't think you can use this in a try catch. You basically are going back to the vb6 way of error handling.
Your help has saved me hundreds of hours of internet surfing.
fblack61