webrequest - server blocks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was sucessfull with web request for 2 months, then one day the server seems
to know how to block my requests.

When I use this URL
"http://patft.uspto.gov/netacgi/nph-...-adv.htm&r=0&p=1&f=S&l=50&Query=an/ibm&d=ptxt"
in a browser, the server will return the data. When I use that same URL in
a webrequest or httpwebrequest, it returns an error. Can I make the
webrequest look the same as one which comes from IE so the server won't block
my auto-generated web requests?
 
Joe,

I had this as well in past and had the same thought as you. However
something was changed in the computer.

I tried it with this code, and it gave me back the html page in the string.

\\\
Module main
Public Sub main()
Dim myReg As Net.HttpWebRequest = _
DirectCast(Net.WebRequest.Create _
("http://patft.uspto.gov/netacgi/nph-...-adv.htm&r=0&p=1&f=S&l=50&Query=an/ibm&d=ptxt"),_ Net.HttpWebRequest) Dim myResp As Net.HttpWebResponse = _ DirectCast(myReg.GetResponse(), Net.HttpWebResponse) Dim myStream As IO.Stream = myResp.GetResponseStream() Dim myreader As New IO.StreamReader(myStream) Dim mystring As String = myreader.ReadToEnd() myResp.Close() End SubEnd Module///I hope this helps,Cor
 
Cor,
Thanks for the effort. I appreciate your help. However, I still generated
the same error with your code. Did you actually get it to run? The error
comes on the 'GetResponse' line. The error message looks like this:

"An unhandled exception of type 'System.Net.WebException' occurred in
system.dll

Additional information: The underlying connection was closed: The server
committed an HTTP protocol violation."

I still somehow suspect my IP or my machine is being blocked. So, please
let me know if it is working on your machine. Thanks.

Joe
 
Joe,
I still somehow suspect my IP or my machine is being blocked. So, please
let me know if it is working on your machine. Thanks.

What do you think that came back. A local sex page?

:-)

Cor
 
Cor,

No really, I didn't get the page in a string. It is a patent website so no
sex page expected. Does the server know my IP and stop my WebRequests but it
doesn't know you and permits your WebRequests?

When I run the URL in the browser, IE, the return is normal. But, in VS.NET
it generates the error.

Then, I thought your code was going to fly like an A380 when it failed too.
So, I am not sure if it ran OK on your machine. I get from your message that
you got the string which is exactly what I want. I did you code precisely -
it still failed. Shit, this is a headache. Thanks for helping!!
 
Joe,

I had this behaviour as well a time ago. My problem is that I don't know
anymore how I fixed it. However it had something to do with my settings or
services.

However, you know now that it is not a setting from that server, I got that
page.

Maybe you can find it yourself, I thought that I had searched it myself
while using Google.

Cor
 
Back
Top