Results 1 to 2 of 2

Thread: File Upload to remote server via HTTPS

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    1

    Question File Upload to remote server via HTTPS

    Hi All
    I am working on a project in which i have to upload files to an remote
    server via HTTPS.
    For that i have written the following lines of code,but when i execute it I
    am getting an
    HTTP:500 Internal Server Error.Please let me know where went wrong in it.

    1.The client has given the credentials(username & password) using those i
    got conneted to the server successfully,but when i run the below code to upload files it is giving me the

    HTTP:500 Internal Server Error.
    Thanks in advance

    Regards
    [email protected]

    The code is

    Try
    Dim postdata As String

    Dim encoding As New ASCIIEncoding

    Dim myWebRequest As HttpWebRequest =
    WebRequest.Create(HTTPS_URL)

    myWebRequest.Method = "POST"

    myHttpWebRequest.ContentType =
    "application/x-www-form-urlencoded"

    postdata = "file" + Microsoft.VisualBasic.ChrW(61) +
    "C:\Documents and Settings\vighneswar\My Documents\My Pictures\vighnesh.jpg"

    Dim byte1 As Byte() = encoding.GetBytes(postdata)

    myWebRequest.ContentLength = postdata.Length

    Dim newStream As Stream = myWebRequest.GetRequestStream()

    newStream.Write(byte1, 0, byte1.Length)

    newStream.Close()

    Dim myWebResponse As WebResponse = myWebRequest.GetResponse()

    Dim Rsr As New StreamReader(myResponse.GetResponseStream(),
    System.Text.Encoding.Default)

    Dim SResponse As String

    SResponse = Rsr.ReadToEnd()

    MsgBox(SResponse)

    Catch ex As WebException

    If ex.Status = WebExceptionStatus.ProtocolError Then

    Dim myWebResponse As HttpWebResponse = ex.Response

    MsgBox(mywebresponse.StatusDescription)

    End Try

  2. #2
    New Member
    Join Date
    Jul 2005
    Posts
    6

    Re: File Upload to remote server via HTTPS

    Hi

    I was getting error 500 when my base64 username, pwd was incorrect


    Does the file have to be in the the body of the request? I'm struggling with a similar issue

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width