Avatar of BigDeer
 asked on

Error Catching in C# ASP.NET Application

I have a simple landing page for helpdesk support requests that automatically populates a user's information from Active Directory as well as their machine name. Everything works perfectly as long as the app is able to perform the DNS lookup on the computer name to populate that particular field. What I'm running into is the inability to catch the error on the lookup and allow the form to just show a blank field if it's unable to do the lookup. My attempts at using a try/catch have failed.

I've attached the CS code and an image of the error received in the browser.
C#ASP.NETMicrosoft Development

Avatar of undefined
Last Comment

8/22/2022 - Mon

Based on the error screenshot looks like you running into error at method call "GetComputer_LanIP()" and not "PingHost()"

Yeah, it gets the error querying DNS. I just want it to keep going if it gets the error and leave that part of the form blank if there's an error. Or any part for that matter.

I just haven't been able to get the catch to work.

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
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

Looks, good. I've deployed it with that in there and we'll see how it works. Thanks for the assistance.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.