Connecting Tech Pros Worldwide Help | Site Map

Url validation

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 11th, 2005, 09:49 PM
Erik Cruz
Guest
 
Posts: n/a
Default Url validation

A custom xml file I wrote for my application has two elements that accepts
urls. I used vs.net to generate a schema file for my file but there is no
validation for urls. How can I validate an element to accept valid urls
including https ones?

TIA,

Erik Cruz



  #2  
Old November 11th, 2005, 09:49 PM
Chris Lovett
Guest
 
Posts: n/a
Default Re: Url validation

The best you can do with XSD is the primitive type called "anyURI". Beyond
that you'll have to write code. You can use the System.Uri class:

try {
Uri uri = new Uri(node.InnerText);
// here you might also want to check the Uri "scheme" to make sure it is
one you accept, like http, https, and file.
} catch (Exception e) {
// then it was a bad URL...
}

"Erik Cruz" <erikacf.nospam@antares.com.br> wrote in message
news:%23lN6xRjTDHA.1912@tk2msftngp13.phx.gbl...[color=blue]
> A custom xml file I wrote for my application has two elements that accepts
> urls. I used vs.net to generate a schema file for my file but there is no
> validation for urls. How can I validate an element to accept valid urls
> including https ones?
>
> TIA,
>
> Erik Cruz
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.