I used to download .zip file from given link using vb.net code. But recently it stopped working and I get
System.Net.WebException: 'The operation has timed out
Below is my code:
Dim strUrl As String
strUrl = "http://www.nseindia.com/api/reports?archives=%5B%7B%22name%22%3A%22CM%20-%20Bhavcopy(csv)%22%2C%22type%22%3A%22archives%22%2C%22category%22%3A%22capital-market%22%2C%22section%22%3A%22equities%22%7D%5D&date=27-Jan-2021&type=equities&mode=single"
Dim fileName As String
fileName = "C:UsersmyNameDownloadsMyCustomerDownloadmyExcel.zip"
Dim wc As WebClient = New WebClient()
wc.Headers("accept") = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
wc.Headers("accept-language") = "en-US,en;q=0.9"
wc.Headers("accept-encoding") = "gzip, deflate, br"
wc.Headers("user-agent") = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36"
wc.DownloadFile(strUrl, fileName)
It used to work before but suddenly stopped working. Did I need to add/update any other settings?
question from:
https://stackoverflow.com/questions/65938798/unable-to-download-zip-file-file-from-given-link 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…