Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Tip - How to validate a URL
Old 07-02-2007, 07:05 PM Tip - How to validate a URL
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
It's easy - you don't need regular expressions at all! Just construct a URI with a string seed value, and if it doesn't throw an exception, you're golden! That doesn't tell you whether the resource actually exists on the server, only whether the string is a valid URL.

Code:
try {
   Uri urlTest = new Uri("http://www.example.com");
   // Do your thing!
} catch(Exception ex) {
   System.Diagnostics.Debug.WriteLine("Not a valid url!");
}
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-09-2007, 03:15 PM Re: Tip - How to validate a URL
Experienced Talker

Posts: 33
Name: Arnold Smith
Trades: 0
thanks ... good share
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
arnold is offline
Reply With Quote
View Public Profile Visit arnold's homepage!
 
Reply     « Reply to Tip - How to validate a URL
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37248 seconds with 12 queries