troubleshooting Question

Uplolad file via System.Net.HttpWebRequest

Avatar of Shezad Ahmed
Shezad AhmedFlag for United Kingdom of Great Britain and Northern Ireland asked on
Visual Basic.NET
1 Comment1 Solution106 ViewsLast Modified:
I am trying to upload a file using HttpWebRequest.

The file does not seem to get uploaded.

I don't get any errors.


            Dim FTPaddress As String = "https://<server>/test/Khaosrs.exe/soap/IKosWeb/" + FileInfo.Name

            Dim request As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(FTPaddress), System.Net.HttpWebRequest)
            request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

            Dim file() As Byte = System.IO.File.ReadAllBytes(Filelocation)

            Dim strz As System.IO.Stream = request.GetRequestStream()
            strz.Write(file, 0, file.Length)

        Catch ex As Exception
            WritetoEventViewer("CPS - SL Update - UploadFiletoKhaosFTPsite() - " + ex.Message, True)
        End Try
Éric Moreau
Senior .Net Consultant
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros