Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, my problem here is that zippyshare generates links that only works with that current session. So, I want the webbrowser to download the file, but not show the dialog as it is a automated tool to download files.

I tried getting the direct url to file and using,

VB
My.Computer.Network.DownloadFile(dlurl, Application.StartupPath + "\123.zip")


dlurl from where i got the url of file as string.

I tried it after and before downloading the file from webbrowser but my bad both of them failed and returned me a 0 bytes file in that location :/

Its like i can only download from the webbrowser session.

VB
Dim Str As String = Me.WebBrowser1.Document.GetElementById("downloadB").GetAttribute("href")
        If (Str.EndsWith("zip")) Then
            WebBrowser1.Navigate("http://www33.zippyshare.com" + Str)
        End If



Is this possible in c++ ? I need to first get the url from webbrowser.document and then download it and save it. Even console applications will do till I am able to get the ID, i had to use the webbrowser so i can get the webbrowser.document to get the link.

Links only work with that session. If I download the file from, lets say chrome, and then copy the direct link to firefox it won't work. but inside chrome i can use the link again and again and download it.
Posted

1 solution

using System.Net;

WebClient Client = new WebClient();

string URL="Download URL"
string FilePath = Server.MapPath("~/FolderName/");
string FileName= "test";

Client.DownloadFile(new Uri(URL), FilePath + FileName);
 
Share this answer
 
Comments
KKS21199 10-Oct-14 8:39am    
didn't you see my post. It says, i need to get download url from webbrowser.document.get attribute. But once i get the link, i can only download it from webbrowser itself, if I use webclient it won't work because of zippyshare system. Will only work with the same session. Can webclient get the link ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900