webrequest - server blocks

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JoePage

    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=PT O2&Sect2=HITOFF &u=%2Fnetahtml% 2Fsearch-adv.htm&r=0&p=1 &f=S&l=50&Query =an%2Fibm&d=ptx t"
    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?
  • Cor Ligthert

    #2
    Re: webrequest - server blocks

    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.HttpWebRequ est = _
    DirectCast(Net. WebRequest.Crea te _
    ("http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PT O2&Sect2=HITOFF &u=%2Fnetahtml% 2Fsearch-adv.htm&r=0&p=1 &f=S&l=50&Query =an%2Fibm&d=ptx t"),_ Net.HttpWebRequ est) Dim myResp As Net.HttpWebResp onse = _ DirectCast(myRe g.GetResponse() , Net.HttpWebResp onse) Dim myStream As IO.Stream = myResp.GetRespo nseStream() Dim myreader As New IO.StreamReader (myStream) Dim mystring As String = myreader.ReadTo End() myResp.Close() End SubEnd Module///I hope this helps,Cor

    Comment

    • JoePage

      #3
      Re: webrequest - server blocks

      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.Web Exception' 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:
      [color=blue]
      > 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.HttpWebRequ est = _
      > DirectCast(Net. WebRequest.Crea te _
      > ("http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PT O2&Sect2=HITOFF &u=%2Fnetahtml% 2Fsearch-adv.htm&r=0&p=1 &f=S&l=50&Query =an%2Fibm&d=ptx t"),_ Net.HttpWebRequ est) Dim myResp As Net.HttpWebResp onse = _ DirectCast(myRe g.GetResponse() , Net.HttpWebResp onse) Dim myStream As IO.Stream = myResp.GetRespo nseStream() Dim myreader As New IO.StreamReader (myStream) Dim mystring As String = myreader.ReadTo End() myResp.Close() End SubEnd Module///I hope this helps,Cor
      >
      >[/color]

      Comment

      • Cor Ligthert

        #4
        Re: webrequest - server blocks

        Joe,
        [color=blue]
        > 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.
        >[color=green]
        >> I tried it with this code, and it gave me back the html page in the
        >> string.[/color][/color]

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

        :-)

        Cor


        Comment

        • JoePage

          #5
          Re: webrequest - server blocks

          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:
          [color=blue]
          > Joe,
          >[color=green]
          > > 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.
          > >[color=darkred]
          > >> I tried it with this code, and it gave me back the html page in the
          > >> string.[/color][/color]
          >
          > What do you think that came back. A local sex page?
          >
          > :-)
          >
          > Cor
          >
          >
          >[/color]

          Comment

          • Cor Ligthert

            #6
            Re: webrequest - server blocks

            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


            Comment

            Working...