|
-
Jun 17th, 2010, 08:37 AM
#1
Thread Starter
New Member
Http problem in vb.net
dear experts
i have w big problem, i need to solve it as soon as possible,
i have a link to a web site i'm tying to retrieve data from it but unfortunately i have receive an error in vb " The remote server returned an error: (400) Bad Request."
the URL work fine in the browser but i guess that hi content are dynamic or retrieved from another page, my code work fine with other URL like google.com
so any one faced a problem like this ?
thx you
-
Jun 17th, 2010, 09:49 PM
#2
Frenzied Member
Re: Http problem in vb.net
You adding http:// in from of url? when you get the source?
-
Jun 17th, 2010, 10:18 PM
#3
Re: Http problem in vb.net
As you haven't actually shown us what you're doing it's very difficult for us to say what you might be doing wrong.
-
Jun 18th, 2010, 01:33 AM
#4
Thread Starter
New Member
Re: Http problem in vb.net
 Originally Posted by jmcilhinney
As you haven't actually shown us what you're doing it's very difficult for us to say what you might be doing wrong.
this is my code:
Code:
Dim qstr As String
'qstr = "http://mylink.com"
Dim HttpWReq As HttpWebRequest
Dim HttpWResp As HttpWebResponse
Dim streamResponse As Stream
Dim streamRead As StreamReader
Dim HttpWebRespStr As String
Dim conn As System.Data.SqlClient.SqlConnection
Dim cmd As System.Data.SqlClient.SqlCommand
HttpWReq = CType(WebRequest.Create(qstr), HttpWebRequest)
HttpWReq.KeepAlive = True
HttpWReq.Timeout = CDbl(0.5) * 20000
HttpWResp = CType(HttpWReq.GetResponse(), HttpWebResponse)
If HttpWReq.HaveResponse Then
streamResponse = HttpWResp.GetResponseStream()
streamRead = New StreamReader(streamResponse)
HttpWebRespStr = CStr(streamRead.ReadToEnd)
streamResponse.Close()
streamRead.Close()
HttpWResp.Close()
Console.WriteLine(HttpWebRespStr)
Dim result As String = HttpWebRespStr
End If
when i'm using google.com i have receive page buddy but when i'm using my link no result found i got the following error: "The remote server returned an error: (406) Not Acceptable."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|