Possible Duplicate:
C# How can I check if a URL exists/is valid?
Work on C# vs2010.
Want to check url are valid or not .Suppose I have three url like www.google.com,www.ggg.com,www.gef.com .
When I brows on http://www.google.com =if page available then I want a response , this page is valid and url is valid.
When I brows on http://www.ggg.com or http://www.gef.com =if page not available then I want a response ,this page is not valid and url is not valid.
Is it possible ?Is there any idea ,or suggestion to solve this problem?
Thanks in advance ,if have any query plz ask.
.NET: Check URL's response status code?
First answer will return “url status”.
Then check the return status with if condition == “400” .. etc.
An example;
foreach(var url in urls)
{
//cast string to HttpResponse will need here...
if( GetHeaders(url).ToString() == "400" )
MessageBox.Show(url + " status code is 400");
}
Something like that...