Webclient.downloadfile errors with exception: "Too many automatic redirections were attempted" RRS feed

  • Question

  • I get a webexception: "Too many automatic redirections were attempted"

    How do I get past this exception?  I don't readily see a way to set the number of redirects for the webclient class.

            Dim _networkfile, _locallocation, _localfile As String
            _networkfile = ""
            _locallocation = My.Computer.FileSystem.SpecialDirectories.MyDocuments
            _localfile = "Myfile.xlsx"
            Dim myWebClient As New System.Net.WebClient
            myWebClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
                myWebClient.DownloadFile(_networkfile, _locallocation & _localfile)
            Catch ex As Exception
            End Try

    • Moved by Mike Feng Tuesday, April 23, 2013 8:08 AM
    Monday, April 22, 2013 3:19 AM

All replies