download file by post data to web server

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

    #1

    download file by post data to web server

    Hello,

    I'm working right now on project in vb.net 2005 for my company, i need the
    project to download file from the company web site.
    In order to get the file i have to give the site address
    http://www.somthing.com and then send to the server post data like
    "&d=10202" to get the file.
    i've search google and newsgroups but I didn't find anything to solve my
    problem, I found this example
    http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
    understand it.
    if anyone know a document or other source code or can explain how to do it
    i'll be grateful

    Thanks

  • Michel Posseth  [MCP]

    #2
    Re: download file by post data to web server


    see the example i showed here




    ofcourse in the case of a binary file you should only use the byte buffer
    var

    be aware that this example is a true post the values are send in the message
    header not over the url
    in the case of http://www.example.com/justaname.aspx?bla=hello&
    where the variabel is bla and the value is hello we talk about a Get method

    regards

    Michel


    "BiT" <shirisason@wal la.comschreef in bericht
    news:K5Cdnc_QdY 3UOtPbnZ2dnUVZ8 t-nnZ2d@giganews. com...
    Hello,
    >
    I'm working right now on project in vb.net 2005 for my company, i need the
    project to download file from the company web site.
    In order to get the file i have to give the site address
    http://www.somthing.com and then send to the server post data like
    "&d=10202" to get the file.
    i've search google and newsgroups but I didn't find anything to solve my
    problem, I found this example
    http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
    understand it.
    if anyone know a document or other source code or can explain how to do it
    i'll be grateful
    >
    Thanks

    Comment

    • BiT

      #3
      Re: download file by post data to web server

      first thanks for the answear

      i've tried your code but I keep getting back 417 errors form the server
      any idea?

      "Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
      news:OOH$vagmHH A.4188@TK2MSFTN GP02.phx.gbl...
      >
      see the example i showed here
      >

      >
      >
      ofcourse in the case of a binary file you should only use the byte buffer
      var
      >
      be aware that this example is a true post the values are send in the
      message header not over the url
      in the case of http://www.example.com/justaname.aspx?bla=hello&
      where the variabel is bla and the value is hello we talk about a Get
      method
      >
      regards
      >
      Michel
      >
      >
      "BiT" <shirisason@wal la.comschreef in bericht
      news:K5Cdnc_QdY 3UOtPbnZ2dnUVZ8 t-nnZ2d@giganews. com...
      >Hello,
      >>
      >I'm working right now on project in vb.net 2005 for my company, i need
      >the project to download file from the company web site.
      >In order to get the file i have to give the site address
      >http://www.somthing.com and then send to the server post data like
      >"&d=10202" to get the file.
      >i've search google and newsgroups but I didn't find anything to solve my
      >problem, I found this example
      >http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
      >understand it.
      >if anyone know a document or other source code or can explain how to do
      >it i'll be grateful
      >>
      >Thanks
      >
      >

      Comment

      • Michel Posseth  [MCP]

        #4
        Re: download file by post data to web server

        i've tried your code but I keep getting back 417 errors form the server
        any idea?

        strange ,,,, "failed expectation" i have never encountered this error
        myself


        maybe you could post your code here , so we can have a look at it


        "BiT" <shirisason@wal la.comschreef in bericht
        news:bfKdnUpGCe qkjc3bnZ2dnUVZ8 seinZ2d@giganew s.com...
        first thanks for the answear
        >
        i've tried your code but I keep getting back 417 errors form the server
        any idea?
        >
        "Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
        news:OOH$vagmHH A.4188@TK2MSFTN GP02.phx.gbl...
        >>
        >see the example i showed here
        >>
        >http://groups.google.nl/group/micros...704b412827a8b8
        >>
        >>
        >ofcourse in the case of a binary file you should only use the byte buffer
        >var
        >>
        >be aware that this example is a true post the values are send in the
        >message header not over the url
        >in the case of http://www.example.com/justaname.aspx?bla=hello&
        >where the variabel is bla and the value is hello we talk about a Get
        >method
        >>
        >regards
        >>
        >Michel
        >>
        >>
        >"BiT" <shirisason@wal la.comschreef in bericht
        >news:K5Cdnc_Qd Y3UOtPbnZ2dnUVZ 8t-nnZ2d@giganews. com...
        >>Hello,
        >>>
        >>I'm working right now on project in vb.net 2005 for my company, i need
        >>the project to download file from the company web site.
        >>In order to get the file i have to give the site address
        >>http://www.somthing.com and then send to the server post data like
        >>"&d=10202" to get the file.
        >>i've search google and newsgroups but I didn't find anything to solve my
        >>problem, I found this example
        >>http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
        >>understand it.
        >>if anyone know a document or other source code or can explain how to do
        >>it i'll be grateful
        >>>
        >>Thanks
        >>
        >>
        >

        Comment

        • BiT

          #5
          Re: download file by post data to web server

          Dim web As New System.Net.WebC lient()
          web.Headers.Add ("Content-Type", "applicatio n/x-www-form-urlencoded")

          Dim d As Byte() =
          System.Text.Enc oding.ASCII.Get Bytes("?getnzb= Get+NZB&binary% 5B%5D=1115165")

          Dim res As Byte() = web.UploadData( "http://www.newzleech.c om/", "POST", d)

          the odd thing is i can do it in one HTML code line and it's work perfect:
          FORM action=http://www.newzleech.c om/?getnzb=Get+NZB &binary%5B%5D=1 115165
          method=post>
          <INPUT type=submit value="test" name=getnz>

          thanks

          "Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
          news:u44Lz6smHH A.1328@TK2MSFTN GP05.phx.gbl...
          >i've tried your code but I keep getting back 417 errors form the server
          >any idea?
          >
          >
          strange ,,,, "failed expectation" i have never encountered this error
          myself
          >
          >
          maybe you could post your code here , so we can have a look at it
          >
          >
          "BiT" <shirisason@wal la.comschreef in bericht
          news:bfKdnUpGCe qkjc3bnZ2dnUVZ8 seinZ2d@giganew s.com...
          >first thanks for the answear
          >>
          >i've tried your code but I keep getting back 417 errors form the server
          >any idea?
          >>
          >"Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
          >news:OOH$vagmH HA.4188@TK2MSFT NGP02.phx.gbl.. .
          >>>
          >>see the example i showed here
          >>>
          >>http://groups.google.nl/group/micros...704b412827a8b8
          >>>
          >>>
          >>ofcourse in the case of a binary file you should only use the byte
          >>buffer var
          >>>
          >>be aware that this example is a true post the values are send in the
          >>message header not over the url
          >>in the case of http://www.example.com/justaname.aspx?bla=hello&
          >>where the variabel is bla and the value is hello we talk about a Get
          >>method
          >>>
          >>regards
          >>>
          >>Michel
          >>>
          >>>
          >>"BiT" <shirisason@wal la.comschreef in bericht
          >>news:K5Cdnc_Q dY3UOtPbnZ2dnUV Z8t-nnZ2d@giganews. com...
          >>>Hello,
          >>>>
          >>>I'm working right now on project in vb.net 2005 for my company, i need
          >>>the project to download file from the company web site.
          >>>In order to get the file i have to give the site address
          >>>http://www.somthing.com and then send to the server post data like
          >>>"&d=10202" to get the file.
          >>>i've search google and newsgroups but I didn't find anything to solve
          >>>my problem, I found this example
          >>>http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
          >>>understand it.
          >>>if anyone know a document or other source code or can explain how to do
          >>>it i'll be grateful
          >>>>
          >>>Thanks
          >>>
          >>>
          >>
          >
          >

          Comment

          • Michel Posseth [MCP]

            #6
            Re: download file by post data to web server

            This wil work ( tested )
            Dim web As New System.Net.WebC lient()

            web.Headers.Add ("Content-Type", "applicatio n/x-www-form-urlencoded")

            Dim d As Byte() = {}

            Dim byteData As Byte() =
            web.UploadData( "http://www.newzleech.c om?getnzb=Get+N ZB&binary%5B%5D =1115165&",
            "POST", d)

            Dim oFileStream As New System.IO.FileS tream("bytes.nz b",
            System.IO.FileM ode.Create)

            oFileStream.Wri te(byteData, 0, byteData.Length )

            oFileStream.Clo se()

            i have tested this on my system when i double click the bytes.nzb my news
            leecher start downloading 15 files of a supervideo called popeye patriotic
            popeye 1957

            regards



            Michel













            "BiT" <shirisason@wal la.comschreef in bericht
            news:RdKdnYrCh5 G91M3bnZ2dnUVZ8 tmhnZ2d@giganew s.com...
            Dim web As New System.Net.WebC lient()
            web.Headers.Add ("Content-Type", "applicatio n/x-www-form-urlencoded")
            >
            Dim d As Byte() =
            System.Text.Enc oding.ASCII.Get Bytes("?getnzb= Get+NZB&binary% 5B%5D=1115165")
            >
            Dim res As Byte() = web.UploadData( "http://www.newzleech.c om/", "POST", d)
            >
            the odd thing is i can do it in one HTML code line and it's work perfect:
            FORM action=http://www.newzleech.c om/?getnzb=Get+NZB &binary%5B%5D=1 115165
            method=post>
            <INPUT type=submit value="test" name=getnz>
            >
            thanks
            >
            "Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
            news:u44Lz6smHH A.1328@TK2MSFTN GP05.phx.gbl...
            >>i've tried your code but I keep getting back 417 errors form the server
            >>any idea?
            >>
            >>
            >strange ,,,, "failed expectation" i have never encountered this error
            >myself
            >>
            >>
            >maybe you could post your code here , so we can have a look at it
            >>
            >>
            >"BiT" <shirisason@wal la.comschreef in bericht
            >news:bfKdnUpGC eqkjc3bnZ2dnUVZ 8seinZ2d@gigane ws.com...
            >>first thanks for the answear
            >>>
            >>i've tried your code but I keep getting back 417 errors form the server
            >>any idea?
            >>>
            >>"Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
            >>news:OOH$vagm HHA.4188@TK2MSF TNGP02.phx.gbl. ..
            >>>>
            >>>see the example i showed here
            >>>>
            >>>http://groups.google.nl/group/micros...704b412827a8b8
            >>>>
            >>>>
            >>>ofcourse in the case of a binary file you should only use the byte
            >>>buffer var
            >>>>
            >>>be aware that this example is a true post the values are send in the
            >>>message header not over the url
            >>>in the case of http://www.example.com/justaname.aspx?bla=hello&
            >>>where the variabel is bla and the value is hello we talk about a Get
            >>>method
            >>>>
            >>>regards
            >>>>
            >>>Michel
            >>>>
            >>>>
            >>>"BiT" <shirisason@wal la.comschreef in bericht
            >>>news:K5Cdnc_ QdY3UOtPbnZ2dnU VZ8t-nnZ2d@giganews. com...
            >>>>Hello,
            >>>>>
            >>>>I'm working right now on project in vb.net 2005 for my company, i need
            >>>>the project to download file from the company web site.
            >>>>In order to get the file i have to give the site address
            >>>>http://www.somthing.com and then send to the server post data like
            >>>>"&d=10202 " to get the file.
            >>>>i've search google and newsgroups but I didn't find anything to solve
            >>>>my problem, I found this example
            >>>>http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
            >>>>understan d it.
            >>>>if anyone know a document or other source code or can explain how to
            >>>>do it i'll be grateful
            >>>>>
            >>>>Thanks
            >>>>
            >>>>
            >>>
            >>
            >>
            >

            Comment

            • BiT

              #7
              Re: download file by post data to web server

              Michel thanks alot
              and once again thanks


              "Michel Posseth [MCP]" <msnews@posseth .comwrote in message
              news:ONXntLwmHH A.3872@TK2MSFTN GP04.phx.gbl...
              This wil work ( tested )
              Dim web As New System.Net.WebC lient()
              >
              web.Headers.Add ("Content-Type", "applicatio n/x-www-form-urlencoded")
              >
              Dim d As Byte() = {}
              >
              Dim byteData As Byte() =
              web.UploadData( "http://www.newzleech.c om?getnzb=Get+N ZB&binary%5B%5D =1115165&",
              "POST", d)
              >
              Dim oFileStream As New System.IO.FileS tream("bytes.nz b",
              System.IO.FileM ode.Create)
              >
              oFileStream.Wri te(byteData, 0, byteData.Length )
              >
              oFileStream.Clo se()
              >
              i have tested this on my system when i double click the bytes.nzb my news
              leecher start downloading 15 files of a supervideo called popeye patriotic
              popeye 1957
              >
              regards
              >
              >
              >
              Michel
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              "BiT" <shirisason@wal la.comschreef in bericht
              news:RdKdnYrCh5 G91M3bnZ2dnUVZ8 tmhnZ2d@giganew s.com...
              >Dim web As New System.Net.WebC lient()
              >web.Headers.Ad d("Content-Type", "applicatio n/x-www-form-urlencoded")
              >>
              >Dim d As Byte() =
              >System.Text.En coding.ASCII.Ge tBytes("?getnzb =Get+NZB&binary %5B%5D=1115165" )
              >>
              >Dim res As Byte() = web.UploadData( "http://www.newzleech.c om/", "POST",
              >d)
              >>
              >the odd thing is i can do it in one HTML code line and it's work perfect:
              >FORM action=http://www.newzleech.c om/?getnzb=Get+NZB &binary%5B%5D=1 115165
              >method=post>
              ><INPUT type=submit value="test" name=getnz>
              >>
              >thanks
              >>
              >"Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
              >news:u44Lz6smH HA.1328@TK2MSFT NGP05.phx.gbl.. .
              >>>i've tried your code but I keep getting back 417 errors form the server
              >>>any idea?
              >>>
              >>>
              >>strange ,,,, "failed expectation" i have never encountered this error
              >>myself
              >>>
              >>>
              >>maybe you could post your code here , so we can have a look at it
              >>>
              >>>
              >>"BiT" <shirisason@wal la.comschreef in bericht
              >>news:bfKdnUpG Ceqkjc3bnZ2dnUV Z8seinZ2d@gigan ews.com...
              >>>first thanks for the answear
              >>>>
              >>>i've tried your code but I keep getting back 417 errors form the server
              >>>any idea?
              >>>>
              >>>"Michel Posseth [MCP]" <MSDN@posseth.c omwrote in message
              >>>news:OOH$vag mHHA.4188@TK2MS FTNGP02.phx.gbl ...
              >>>>>
              >>>>see the example i showed here
              >>>>>
              >>>>http://groups.google.nl/group/micros...704b412827a8b8
              >>>>>
              >>>>>
              >>>>ofcourse in the case of a binary file you should only use the byte
              >>>>buffer var
              >>>>>
              >>>>be aware that this example is a true post the values are send in the
              >>>>message header not over the url
              >>>>in the case of http://www.example.com/justaname.aspx?bla=hello&
              >>>>where the variabel is bla and the value is hello we talk about a Get
              >>>>method
              >>>>>
              >>>>regards
              >>>>>
              >>>>Michel
              >>>>>
              >>>>>
              >>>>"BiT" <shirisason@wal la.comschreef in bericht
              >>>>news:K5Cdnc _QdY3UOtPbnZ2dn UVZ8t-nnZ2d@giganews. com...
              >>>>>Hello,
              >>>>>>
              >>>>>I'm working right now on project in vb.net 2005 for my company, i
              >>>>>need the project to download file from the company web site.
              >>>>>In order to get the file i have to give the site address
              >>>>>http://www.somthing.com and then send to the server post data like
              >>>>>"&d=1020 2" to get the file.
              >>>>>i've search google and newsgroups but I didn't find anything to solve
              >>>>>my problem, I found this example
              >>>>>http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
              >>>>>understa nd it.
              >>>>>if anyone know a document or other source code or can explain how to
              >>>>>do it i'll be grateful
              >>>>>>
              >>>>>Thanks
              >>>>>
              >>>>>
              >>>>
              >>>
              >>>
              >>
              >
              >

              Comment

              • the_only_steven@hotmail.com

                #8
                Re: download file by post data to web server

                if i want to auto click a button which is on a website can i use the
                Post system also then?

                the button is java coded and its code is like this
                <input type="submit" name="submit" value="submit!" >

                the submit! is the text that is on the button.


                I have tried many things, exept the post system cause i dont really
                understand it lol


                Thx

                Comment

                • Michel Posseth  [MCP]

                  #9
                  Re: download file by post data to web server


                  No ,, however you can create all the forms parameters collection and send
                  it like the example i showed here





                  And if the website is showed in the webbrowser control there might be a
                  possibility to trigger the submit action

                  regards

                  Michel



                  <the_only_steve n@hotmail.comsc hreef in bericht
                  news:1179693481 .658174.179880@ y2g2000prf.goog legroups.com...
                  if i want to auto click a button which is on a website can i use the
                  Post system also then?
                  >
                  the button is java coded and its code is like this
                  <input type="submit" name="submit" value="submit!" >
                  >
                  the submit! is the text that is on the button.
                  >
                  >
                  I have tried many things, exept the post system cause i dont really
                  understand it lol
                  >
                  >
                  Thx
                  >

                  Comment

                  Working...