I am downloading a bunch of PDF files using background jobs.
For Each dr As DataRow In dt.Rows
Dim url As String = dr("file_url").ToString()
BackgroundJob.Enqueue(Sub() downloadFile(url))
Next
downloadFile(url)
looks like this;
Private Sub downloadFile(url As String)
Dim remoteUri As String = url
Dim fileName As String = Guid.NewGuid().ToString() + ".pdf"
Using client As New WebClient()
client.DownloadFile(remoteUri, Server.MapPath("/Temp/") + fileName)
End Using
End Sub
When I run, I am getting the following exception:
Value cannot be null. Parameter name: value
What I am doing wrong?