Connecting Tech Pros Worldwide Forums | Help | Site Map

download file by post data to web server

BiT
Guest
 
Posts: n/a
#1: May 19 '07
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]
Guest
 
Posts: n/a
#2: May 19 '07

re: download file by post data to web server



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@walla.comschreef in bericht
news:K5Cdnc_QdY3UOtPbnZ2dnUVZ8t-nnZ2d@giganews.com...
Quote:
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

BiT
Guest
 
Posts: n/a
#3: May 20 '07

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.comwrote in message
news:OOH$vagmHHA.4188@TK2MSFTNGP02.phx.gbl...
Quote:
>
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@walla.comschreef in bericht
news:K5Cdnc_QdY3UOtPbnZ2dnUVZ8t-nnZ2d@giganews.com...
Quote:
>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]
Guest
 
Posts: n/a
#4: May 20 '07

re: download file by post data to web server


i've tried your code but I keep getting back 417 errors form the server
Quote:
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@walla.comschreef in bericht
news:bfKdnUpGCeqkjc3bnZ2dnUVZ8seinZ2d@giganews.com ...
Quote:
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.comwrote in message
news:OOH$vagmHHA.4188@TK2MSFTNGP02.phx.gbl...
Quote:
>>
>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@walla.comschreef in bericht
>news:K5Cdnc_QdY3UOtPbnZ2dnUVZ8t-nnZ2d@giganews.com...
Quote:
>>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
>>
>>
>

BiT
Guest
 
Posts: n/a
#5: May 20 '07

re: download file by post data to web server


Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

Dim d As Byte() =
System.Text.Encoding.ASCII.GetBytes("?getnzb=Get+N ZB&binary%5B%5D=1115165")

Dim res As Byte() = web.UploadData("http://www.newzleech.com/", "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.com/?getnzb=Get+NZB&binary%5B%5D=1115165
method=post>
<INPUT type=submit value="test" name=getnz>

thanks

"Michel Posseth [MCP]" <MSDN@posseth.comwrote in message
news:u44Lz6smHHA.1328@TK2MSFTNGP05.phx.gbl...
Quote:
Quote:
>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@walla.comschreef in bericht
news:bfKdnUpGCeqkjc3bnZ2dnUVZ8seinZ2d@giganews.com ...
Quote:
>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.comwrote in message
>news:OOH$vagmHHA.4188@TK2MSFTNGP02.phx.gbl...
Quote:
>>>
>>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@walla.comschreef in bericht
>>news:K5Cdnc_QdY3UOtPbnZ2dnUVZ8t-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
>>>
>>>
>>
>
>
Michel Posseth [MCP]
Guest
 
Posts: n/a
#6: May 20 '07

re: download file by post data to web server


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

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

Dim d As Byte() = {}

Dim byteData As Byte() =
web.UploadData("http://www.newzleech.com?getnzb=Get+NZB&binary%5B%5D=1115 165&",
"POST", d)

Dim oFileStream As New System.IO.FileStream("bytes.nzb",
System.IO.FileMode.Create)

oFileStream.Write(byteData, 0, byteData.Length)

oFileStream.Close()

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@walla.comschreef in bericht
news:RdKdnYrCh5G91M3bnZ2dnUVZ8tmhnZ2d@giganews.com ...
Quote:
Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
>
Dim d As Byte() =
System.Text.Encoding.ASCII.GetBytes("?getnzb=Get+N ZB&binary%5B%5D=1115165")
>
Dim res As Byte() = web.UploadData("http://www.newzleech.com/", "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.com/?getnzb=Get+NZB&binary%5B%5D=1115165
method=post>
<INPUT type=submit value="test" name=getnz>
>
thanks
>
"Michel Posseth [MCP]" <MSDN@posseth.comwrote in message
news:u44Lz6smHHA.1328@TK2MSFTNGP05.phx.gbl...
Quote:
Quote:
>>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@walla.comschreef in bericht
>news:bfKdnUpGCeqkjc3bnZ2dnUVZ8seinZ2d@giganews.co m...
Quote:
>>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.comwrote in message
>>news:OOH$vagmHHA.4188@TK2MSFTNGP02.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@walla.comschreef in bericht
>>>news:K5Cdnc_QdY3UOtPbnZ2dnUVZ8t-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
>>>>
>>>>
>>>
>>
>>
>

BiT
Guest
 
Posts: n/a
#7: May 20 '07

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:ONXntLwmHHA.3872@TK2MSFTNGP04.phx.gbl...
Quote:
This wil work ( tested )
Dim web As New System.Net.WebClient()
>
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
>
Dim d As Byte() = {}
>
Dim byteData As Byte() =
web.UploadData("http://www.newzleech.com?getnzb=Get+NZB&binary%5B%5D=1115 165&",
"POST", d)
>
Dim oFileStream As New System.IO.FileStream("bytes.nzb",
System.IO.FileMode.Create)
>
oFileStream.Write(byteData, 0, byteData.Length)
>
oFileStream.Close()
>
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@walla.comschreef in bericht
news:RdKdnYrCh5G91M3bnZ2dnUVZ8tmhnZ2d@giganews.com ...
Quote:
>Dim web As New System.Net.WebClient()
>web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
>>
>Dim d As Byte() =
>System.Text.Encoding.ASCII.GetBytes("?getnzb=Get+ NZB&binary%5B%5D=1115165")
>>
>Dim res As Byte() = web.UploadData("http://www.newzleech.com/", "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.com/?getnzb=Get+NZB&binary%5B%5D=1115165
>method=post>
><INPUT type=submit value="test" name=getnz>
>>
>thanks
>>
>"Michel Posseth [MCP]" <MSDN@posseth.comwrote in message
>news:u44Lz6smHHA.1328@TK2MSFTNGP05.phx.gbl...
Quote:
>>>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@walla.comschreef in bericht
>>news:bfKdnUpGCeqkjc3bnZ2dnUVZ8seinZ2d@giganews.c om...
>>>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.comwrote in message
>>>news:OOH$vagmHHA.4188@TK2MSFTNGP02.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@walla.comschreef in bericht
>>>>news:K5Cdnc_QdY3UOtPbnZ2dnUVZ8t-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
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
the_only_steven@hotmail.com
Guest
 
Posts: n/a
#8: May 20 '07

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

Michel Posseth [MCP]
Guest
 
Posts: n/a
#9: May 21 '07

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


http://groups.google.nl/group/micros...704b412827a8b8


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

regards

Michel



<the_only_steven@hotmail.comschreef in bericht
news:1179693481.658174.179880@y2g2000prf.googlegro ups.com...
Quote:
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
>

Closed Thread


Similar Visual Basic .NET bytes