URL Validation in Windows Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to validate a URL typed in a textbox in the windows forms using C#
language.
I need complete code.

Thanks in advance.

-Shankar
 
shankar,

What kind of validation are you doing? Do you want to validate the
syntax of the URL? If that is the case then pass the string to the
constructor of the Uri class and it should throw an exception if the url
syntax is not valid.

If you want to validate that the resource exists, then you will need to
call the static Create method on the WebRequest class, passing the URI and
trying to connect to the resource.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top