download a pdf from a website -

Posted on 2007-08-05
Last Modified: 2008-01-09
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,
Question by:Devlinmc
    LVL 15

    Expert Comment

    you should be using the System.Net.HttpWebRequest and System.Net.HttpWebResponse objects to build your spider.
    LVL 15

    Accepted Solution

    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.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now