WebClient DownloadFile over ssl / https

G

gavkel

Can anyone get this to work? All Im getting is the login html being
downloaded.

Would appreciate any help - my heads hurts

Thanks
Gav
 
N

Nicholas Paldino [.NET/C# MVP]

gavkel,

What do you mean the login html? If you are getting a response at all,
then it indicates that you are not having any problems with the SSL
connection or HTTPS.

Can you provide some sample code?
 
G

gavkel

Ok

Uri uri = new
Uri("https://www.scoobydoo.com/downloads/velma_statistics.csv");
WebClient webClient = new WebClient();

CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri("https://www.scoobydoo.com/home.html"),
"Basic", new NetworkCredential("scoobydoobydoo", "Passw0rd"));
webClient.Credentials = mycache;

webClient.DownloadFile(uri, @"c:\gav.txt");

Now, whats happening is Im trying to download velma_statistics.csv (cos
I love her!!) but its over HTTPS. I can see whats happening - when I
copy and paste the contents of the downloaded gav.txt into a html page
in VS, I get the login page that I would need to firstly complete in IE
before successfully downloading my csv file, again manually.

So, any ideas? By the way, I like Daphne too but me and Velma have
always had a thing going on...

Thanks
 
G

gavkel

Ok

Uri uri = new
Uri("https://www.scoobydoo.com/downloads/velma_statistics.csv");
WebClient webClient = new WebClient();

CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri("https://www.scoobydoo.com/home.html"),
"Basic", new NetworkCredential("scoobydoobydoo", "Passw0rd"));
webClient.Credentials = mycache;

webClient.DownloadFile(uri, @"c:\gav.txt");

Now, whats happening is Im trying to download velma_statistics.csv (cos
I love her!!) but its over HTTPS. I can see whats happening - when I
copy and paste the contents of the downloaded gav.txt into a html page
in VS, I get the login page that I would need to firstly complete in IE
before successfully downloading my csv file, again manually.

So, any ideas? By the way, I like Daphne too but me and Velma have
always had a thing going on...

Thanks
 
J

Joerg Jooss

Thus wrote gavkel,
Ok

Uri uri = new
Uri("https://www.scoobydoo.com/downloads/velma_statistics.csv");
WebClient webClient = new WebClient();
CredentialCache mycache = new CredentialCache();
mycache.Add(new
Uri("https://www.scoobydoo.com/home.html"),
"Basic", new NetworkCredential("scoobydoobydoo", "Passw0rd"));
webClient.Credentials = mycache;
webClient.DownloadFile(uri, @"c:\gav.txt");

Now, whats happening is Im trying to download velma_statistics.csv
(cos I love her!!) but its over HTTPS. I can see whats happening -
when I copy and paste the contents of the downloaded gav.txt into a
html page in VS, I get the login page that I would need to firstly
complete in IE before successfully downloading my csv file, again
manually.

So, any ideas? By the way, I like Daphne too but me and Velma have
always had a thing going on...

You'll need to use HttpWebRequest and HttpWebResponse to programmtically
log in to the web site and fetch the file. That's a FAQ, so your favorite
search engine should provide you a lot of references to check out.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top