Connecting Tech Pros Worldwide Forums | Help | Site Map

URL Validation in Windows Forms

shankar
Guest
 
Posts: n/a
#1: Nov 17 '05
How to validate a URL typed in a textbox in the windows forms using C#
language.
I need complete code.

Thanks in advance.

-Shankar

Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Nov 17 '05

re: URL Validation in Windows Forms


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.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"shankar" <shankar@discussions.microsoft.com> wrote in message
news:C3C194FC-18B8-4770-A469-BD05BA9B6E8F@microsoft.com...[color=blue]
> How to validate a URL typed in a textbox in the windows forms using C#
> language.
> I need complete code.
>
> Thanks in advance.
>
> -Shankar[/color]


Closed Thread