Avatar of Shezad Ahmed
Shezad Ahmed
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Uplolad file via System.Net.HttpWebRequest

I am trying to upload a file using HttpWebRequest.

The file does not seem to get uploaded.

I don't get any errors.

  Try


            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)
            strz.Close()
            strz.Dispose()

        Catch ex As Exception
            WritetoEventViewer("CPS - SL Update - UploadFiletoKhaosFTPsite() - " + ex.Message, True)
        End Try
Visual Basic.NET

Avatar of undefined
Last Comment
Éric Moreau

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Éric Moreau

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61