Link to home
Start Free TrialLog in
Avatar of BigDeer
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.
image001.png
helpdesk.cs.txt
Avatar of pateljitu
pateljitu
Flag of Canada image

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

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of pateljitu
pateljitu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BigDeer

ASKER

Looks, good. I've deployed it with that in there and we'll see how it works. Thanks for the assistance.