download a pdf from a website -

I am working on a program that visits a website, log's that websites login page which takes it to a pdf document that i need to download automatically with a preset path, then move on to the next link.

The only way i can make this function currently is using the axwebbrowser, calling this command:
Then sending keys with the path and hitting enter....
as the dontpromtuser call does not work. (this has been discussed elsewhere in the forum)

I have also tried the

Dim getfile As System.Net.WebClient
getfile = New System.Net.WebClient

getfile.DownloadFile("" & MAGIC_NUM & "&case_id=" & CASE_ID & "&doc_num=" & DOC_NUMBER & "&att_num=" & i & "&got_receipt=1", "C:\testthispdf.pdf")

However, the file that is downloaded is currupt and will not open.

If anyone can provide an alternitive method, or possibly something i am doing wrong with either of these two, i would greatly appreciate it.

Thank you,
Who is Participating?
dave4dlConnect With a Mentor Commented:
check out for more info

just treat the pdf as you would any binary file (meaning you don't want to interpret it) and stream it to a destination file.
you should be using the System.Net.HttpWebRequest and System.Net.HttpWebResponse objects to build your spider.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.