webclient-download

AWAIT multiple file downloads with DownloadDataAsync

落花浮王杯 提交于 2019-12-13 11:21:05
问题 I have a zip file creator that takes in a String[] of Urls, and returns a zip file with all of the files in the String[] I figured there would be a number of example of this, but I cannot seem to find an answer to "How to download many files asynchronously and return when done" How do I download {n} files at once, and return the Dictionary only when all downloads are complete? private static Dictionary<string, byte[]> ReturnedFileData(IEnumerable<string> urlList) { var returnList = new

Using WebClient to login and download files

六眼飞鱼酱① 提交于 2019-12-11 20:15:29
问题 I've found different examples of doing this, but haven't been able to get any combination of them to work. Basically, I have an intranet system that can generate documents from a web link, and I know which ones I want to download. I am able to generate the list of links I want to download, but I run into problems with authenticating to the system within the program. I keep getting a 401 error with this this: Public Shared Sub DownloadFiles(_tool As Tool) Dim links As List(Of String) =

Getting links from webpage in Powershell using regular expression

…衆ロ難τιáo~ 提交于 2019-12-11 15:23:44
问题 Below is my code in powershell to fetch the links in a webpage. Intermittently, I get "Cannot index into null array" exception. Is there anything wrong in this code. Help required. $Download = $wc.DownloadString($Link) $List = $Download -split "<a\s+" | %{ [void]($_ -match "^href=[`'`"]([^`'`">\s]*)"); $matches[1] } 回答1: You don't need to parse anything yourself (and as was pointed out in the comments, you can't parse HTML with a regex in the first place). Use Invoke-Webrequest to fetch the

How to know the dropbox folder's shard link if the name is changed

╄→гoц情女王★ 提交于 2019-12-11 10:33:46
问题 I'm using dropbox Core API and faced one issue related to folder downloading. For example I'm just calling folders shared link that I want to download- "https://www.dropbox.com/sh/sssadadsd/afgasga?dl=1" and it's automatically compresses it into .zip archive and downloads it to my pc. The question: What if the user renames the folder, how can I know the shared link without going manually to the Dropbox and copying the shared link ? Is that even possible? Maybe can encrypt somehow using the

downloaded zip file using c# code is invalid

拈花ヽ惹草 提交于 2019-12-11 02:55:36
问题 I have a Dot Net MVC server that stores some zip files. I'm able to download these zip files successfully if I click on the hyperlink. However if I try to download the zip file using WebClient's DownloadFile, I'm able to download the zip file I get an error "Windows cannot open the folder, compressed zip folder is invalid" Server side code : public FilePathResult DownloadFile(int id) { string resultsdir = AppDomain.CurrentDomain.BaseDirectory + "Data\\ResultsDir\\" + res.RequestId.ToString();

Wait until file is downloaded from URL via webClient

我怕爱的太早我们不能终老 提交于 2019-12-11 02:15:34
问题 I have struggle with downloading few MB excel file from URL and then work with it. Im using VS2010 so i cant use await keyword. My code follows: using (WebClient webClient = new WebClient()) { // setting Windows Authentication webClient.UseDefaultCredentials = true; // event fired ExcelToCsv after file is downloaded webClient.DownloadFileCompleted += (sender, e) => ExcelToCsv(fileName); // start download webClient.DownloadFileAsync(new Uri("http://serverx/something/Export.ashx"), exportPath);

Webclient.DownloadFile() .aspx file won't open

徘徊边缘 提交于 2019-12-10 20:41:15
问题 I'm using powershell for the first time. I've learned how to download files using a webclient, using the following code. $client = New-Object System.NET.Webclient $client.DownloadFile( $url, $path ) This seems to work nicely for what I am trying to eventually do, which is download multiple files from a web page at one time. I tried this on a site, which has its files formatted as .pfva files, which are opened as a PDF. no problem. This was a password protected site too. So moving to the site

Getting JSON string from URL in Windows Phone 8

情到浓时终转凉″ 提交于 2019-12-10 20:26:42
问题 So I'm trying to get a Json string from a Url in a windows phone 8 app. I just have to call a callbackurl that returns this string, and that's pretty much it, but somehow I've been stuck on this for days and I just don't understand how to do it I have a urlparser class that contains 2 methods which are : public void ParseJsonUrl(string url) { Uri uri = new Uri(url); WebClient webClient = new WebClient(); webClient.DownloadStringCompleted += webClient_DownloadStringCompleted; webClient

make download resumable using c#

狂风中的少年 提交于 2019-12-10 06:41:06
问题 I am using this method ( WebClient Class) for downloading a file from the Internet : private Task DownloadUpdate(string url, string fileName) { var wc = new WebClient(); return wc.DownloadFileTaskAsync(new Uri(url), @"c:\download" + fileName); } How can I make the download resumable using the above code? 回答1: From HttpWebRequest or WebRequest - Resume Download ASP.NET: Resuming files is done by specifying the byte range of the file you would like to download using the Range HTTP header. This

Error with download a file from https using webclient

怎甘沉沦 提交于 2019-12-08 03:53:11
问题 I have create a piece of code that download a file from a given URL using WebClient. The problem is i am getting the following error when the code is trying to download a file from a HTTPS site. The remote certificate is invalid according to the validation procedure This issue happened only on the server not on the local machine, so i also don't know how to debug it. I have read several answers on the web but didn't find anything that could help me. The piece of code: using (WebClient Client