http Response
-
Hi all, I am runing an application which will check URL in my database there are around 3000 url in my database and i use .net http response and request to check the url the following are the code snippet.. Public Function checkurl(ByVal url As String) As String Dim req As System.Net.HttpWebRequest Dim res As System.Net.HttpWebResponse Dim r As System.IO.StreamReader Dim ex As Exception 'error exeption holder Dim pge As String 'page holder Dim title As String Dim strreturnstring As String 'url = "http://www.getforme.com/e404.htm" ' not working becos have charset =ISO - 8859-1 'url = "http://environmentalchemistry.com/" not working becos have charset = iso - 8859-1 'url = "https://www.iclub.com/investorama.html" Try 'display request url req = req.Create(url) req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)" req.AllowAutoRedirect = True 'get page res = req.GetResponse() r = New System.IO.StreamReader(res.GetResponseStream()) 'pge = r.ReadToEnd r.Close() res.Close() strError = "OK" status = "True" 'Convention is First Value is the Status and Second value is Errmsg strreturnstring = status & "~" & strError Return strreturnstring Catch ex status = "False" strError = ex.Message strreturnstring = status & "~" & strError Return strreturnstring End Try End Function my code working fine but the problem is when my code run URL which as charset = iso - 8859-1 or charset = windows - 1252 it just thro exception that The remote server returned an error: (400) Bad Request. or The underlyng connection is close.. can any one tell the reason why, Thanx for your interest :) regards cyus