webclient downloadstring(URI), URI has 10 mb file. Can I download a certain size of this file?
问题 I have a 10 mb file at an URI I download it with the following codes. WebClient wc = new WebClient(); string file = wc.DownloadString(http://www......com); Can I download certain sizes of this file, such as 1 mb, 5 mb. not whole 10 mb. ? Then stop downloading? Thanks. 回答1: Add the HTTP Range header in your request. Note that this will only work if the server supports it. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for more information about it 回答2: you can use httpwebrequest to