473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

webrequest - server blocks

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-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2Fsea rch-adv.htm&r=0&p=1&f=S&l=50&Query=an%2Fibm&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?
Nov 21 '05 #1
5 1019
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-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2Fsea rch-adv.htm&r=0&p=1&f=S&l=50&Query=an%2Fibm&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

Nov 21 '05 #2
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

"Cor Ligthert" wrote:
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-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2Fsea rch-adv.htm&r=0&p=1&f=S&l=50&Query=an%2Fibm&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

Nov 21 '05 #3
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.
I tried it with this code, and it gave me back the html page in the
string.


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

:-)

Cor
Nov 21 '05 #4
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!!

"Cor Ligthert" wrote:
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.
I tried it with this code, and it gave me back the html page in the
string.


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

:-)

Cor

Nov 21 '05 #5
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
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Keith Selbee | last post by:
I am trying to submit data to a webpage in the form of a post and my code is below. It is a function that takes a url and the post content as strings and then performs the post. But as soon as I...
17
by: James Johnson | last post by:
Dear C#dex, I define a variable: HttpWebRequest webRequest and run the following request webRequest = WebRequest.Create(TARGET_URL) as HttpWebRequest; The webRequest object returns values...
1
by: William F. Robertson, Jr. | last post by:
I am having problems with using the WebRequest object (or HttpWebRequest ). I have created the WebRequest and set the credentials, but when I call GetResponse() it is throwing an internal server...
8
by: John K. | last post by:
Hi I was wondering if it's possible to use the WebRequest class to access a file on windows shared folder with authentication? If yes, what would the syntax be? I've tried to look this up in the...
4
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server...
6
by: Bob | last post by:
Hi, I am new to using a web resource which is not a webservice and I am spinning my wheels with the webrequest class. I am trying to interact with a URI that has been given to me. It is say...
0
by: tascien | last post by:
Hi guys, when i use winhttp, and the server returns status 500, I get the text that the server returned anyway... when i use webrequest, and the server returns status 500, webrequest just...
3
by: Jonathan | last post by:
I appreciate anyone's insight on this as I am new to web programming with .NET. I have a simple method which I use to send various HTTP requests to a web server (snippet below). On the first...
3
by: archana | last post by:
Hi all, My main question is when i send webrequest to server, do ip address related information is also getting send onto server over network? I want to send request using webrequest class....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.