Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > URL Validity

Reply
Thread Tools

URL Validity

 
 
Luke Davis
Guest
Posts: n/a
 
      09-18-2007
Is there an easy method that takes a URL string and checks if it is valid?



Luke


 
Reply With Quote
 
 
 
 
Robbe Morris - [MVP] C#
Guest
Posts: n/a
 
      09-18-2007
What would you consider "invalid"?

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials...d-control.aspx




"Luke Davis" <(E-Mail Removed)> wrote in message
news:eO3CLTj%(E-Mail Removed)...
> Is there an easy method that takes a URL string and checks if it is valid?
>
>
>
> Luke
>


 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      09-18-2007
You can Regex the string, but something like

http://www.thisisafakesite.com/default.aspx

would be seen as valid, as it is correctly formed. You would have to
actually issue a request to the server and check the return code to
determine if it was a real site.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"Luke Davis" <(E-Mail Removed)> wrote in message
news:eO3CLTj%(E-Mail Removed)...
> Is there an easy method that takes a URL string and checks if it is valid?
>
>
>
> Luke
>



 
Reply With Quote
 
Luke Davis
Guest
Posts: n/a
 
      09-18-2007
Invalid as in a 404 error or if it's an image it will come back with a red
"x". There be nothing at the domain. So if I passed http://google.com/
it would come back true, but if I passed http://asfsaf3985r2934.com it will
come back false.


"Robbe Morris - [MVP] C#" <(E-Mail Removed)> wrote in message
news:uPNCpWj%(E-Mail Removed)...
> What would you consider "invalid"?
>
> --
> Robbe Morris [Microsoft MVP - Visual C#]
> .NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
> http://www.eggheadcafe.com/tutorials...d-control.aspx
>
>
>
>
> "Luke Davis" <(E-Mail Removed)> wrote in message
> news:eO3CLTj%(E-Mail Removed)...
>> Is there an easy method that takes a URL string and checks if it is
>> valid?
>>
>>
>>
>> Luke
>>

>



 
Reply With Quote
 
Robbe Morris - [MVP] C#
Guest
Posts: n/a
 
      09-18-2007
HttpWebRequest and HttpWebResponse

There are tons of samples for these two classes.

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials...d-control.aspx




"Luke Davis" <(E-Mail Removed)> wrote in message
news:eKH4s7j%(E-Mail Removed)...
> Invalid as in a 404 error or if it's an image it will come back with a red
> "x". There be nothing at the domain. So if I passed
> http://google.com/ it would come back true, but if I passed
> http://asfsaf3985r2934.com it will come back false.
>
>
> "Robbe Morris - [MVP] C#" <(E-Mail Removed)> wrote in message
> news:uPNCpWj%(E-Mail Removed)...
>> What would you consider "invalid"?
>>
>> --
>> Robbe Morris [Microsoft MVP - Visual C#]
>> .NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
>> http://www.eggheadcafe.com/tutorials...d-control.aspx
>>
>>
>>
>>
>> "Luke Davis" <(E-Mail Removed)> wrote in message
>> news:eO3CLTj%(E-Mail Removed)...
>>> Is there an easy method that takes a URL string and checks if it is
>>> valid?
>>>
>>>
>>>
>>> Luke
>>>

>>

>
>


 
Reply With Quote
 
Donn Felker
Guest
Posts: n/a
 
      09-18-2007
I have a post on how to work with HttpWebRequest here:
http://blog.donnfelker.com/2007/09/1...PNETsCURL.aspx

 
Reply With Quote
 
Jesse Houwing
Guest
Posts: n/a
 
      09-19-2007
Hello Cowboy (Gregory A. Beamer),

> You can Regex the string, but something like
>
> http://www.thisisafakesite.com/default.aspx
>
> would be seen as valid, as it is correctly formed. You would have to
> actually issue a request to the server and check the return code to
> determine if it was a real site.
>
> *************************************************
> | Think outside the box!
> |
> *************************************************
> "Luke Davis" <(E-Mail Removed)> wrote in message
> news:eO3CLTj%(E-Mail Removed)...
>> Is there an easy method that takes a URL string and checks if it is
>> valid?
>>
>> Luke
>>


You could always pass it to the URI class and see what happens. My guess
is that it will choke on incorrectly formatted URI's.

--
Jesse Houwing
jesse.houwing at sogeti.n


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BGP vs OSPF routes validity matteo_cardelli@yahoo.co.uk Cisco 3 05-12-2005 06:53 AM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
Validity oF Webservice URL sendhil ASP .Net Web Services 0 12-06-2003 11:04 PM
Validity of MCSD .NET Kamal Ahmed MCSD 2 10-04-2003 08:52 AM



Advertisments