Keep in touch

you can keep in touch with my all blogs and sites by install this Toolbar...
http://rworldtoolbar.ourtoolbar.com/

Friday, June 27, 2008

URL validation in vb.net 2005

' URL validation
Public Function UrlIsValid(ByVal url As String) As Boolean
If url.ToLower().StartsWith("www.") Then url = "http://" & url
Dim webResponse As Net.HttpWebResponse = Nothing
Try
Dim webRequest As Net.HttpWebRequest = Net.HttpWebRequest.Create(url)
webResponse = DirectCast(webRequest.GetResponse(), Net.HttpWebResponse)
Return True
Catch
Return False
Finally
If webResponse IsNot Nothing Then webResponse.Close()
End Try
End Function

2 comments:

Anonymous said...

thank you ....

............

Unknown said...

Great Code...
Thanks.

My Name Dharmendra Bakrecha.
Mail: dkbakrecha@gmail.com
Web: http://dkbakrecha.webs.com