i have this C# code for download xlsx document from url
var request = (HttpWebRequest)WebRequest.Create("url to xlsx file"); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; request.Headers[HttpRequestHeader.AcceptEncoding] = "gzip,deflate"; using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) using (var output = File.Create("H:\\doc.xlsx")) { stream.CopyTo(output); } my target programming language is VB.net so i changed C# to vb like below
Dim request As HttpWebRequest = WebRequest.Create("url to xlsx file") request.AutomaticDecompression = DecompressionMethods.GZip Or DecompressionMethods.Deflate request.Headers(HttpRequestHeader.AcceptEncoding) = "gzip,deflate" Dim response As WebResponse = request.GetResponse() Dim stream As Stream = response.GetResponseStream() Dim output As FileStream = File.Create("H:\doc.xlsx") stream.CopyTo(output) xlsx file that is downloaded by VB is corrupted and unreadable but C# works well what is the mistake?