URL Validation in Windows Forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shankar

    URL Validation in Windows Forms

    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]

    #2
    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.co m

    "shankar" <shankar@discus sions.microsoft .com> wrote in message
    news:C3C194FC-18B8-4770-A469-BD05BA9B6E8F@mi crosoft.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]


    Comment

    Working...