What would you consider "invalid"?

Signature
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials/aspnet/270e9432-d236-47e7-b1af-5cd3abe27a75
/net-propertygrid-control.aspx
> Is there an easy method that takes a URL string and checks if it is valid?
>
> Luke
Luke Davis - 18 Sep 2007 22:57 GMT
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.
> What would you consider "invalid"?
>
>> Is there an easy method that takes a URL string and checks if it is
>> valid?
>>
>> Luke
Robbe Morris - [MVP] C# - 18 Sep 2007 23:05 GMT
HttpWebRequest and HttpWebResponse
There are tons of samples for these two classes.

Signature
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials/aspnet/270e9432-d236-47e7-b1af-5cd3abe27a75
/net-propertygrid-control.aspx
> 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
[quoted text clipped - 7 lines]
>>>
>>> Luke
Donn Felker - 19 Sep 2007 00:07 GMT
I have a post on how to work with HttpWebRequest here:
http://blog.donnfelker.com/2007/09/13/AutomatedFormPostingWithNETASPNETsCURL.aspx
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.

Signature
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
*************************************************
| Think outside the box!
*************************************************
> Is there an easy method that takes a URL string and checks if it is valid?
>
> Luke
Jesse Houwing - 19 Sep 2007 23:40 GMT
Hello Cowboy (Gregory A. Beamer),
> You can Regex the string, but something like
>
[quoted text clipped - 12 lines]
>>
>> 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