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(use rname & password) using those i
got conneted
to the server successfully,bu t when i run the below code to upload files
it is giving me the
HTTP:500 Internal Server Error.
Thanks in advance
Regards
Vighneswar@nann acomputers.com
The code is
Try
Dim postdata As String
Dim encoding As New ASCIIEncoding
Dim myWebRequest As HttpWebRequest =
WebRequest.Crea te(HTTPS_URL)
myWebRequest.Me thod = "POST"
myHttpWebReques t.ContentType =
"applicatio n/x-www-form-urlencoded"
postdata = "file" + Microsoft.Visua lBasic.ChrW(61) +
"C:\Documen ts and Settings\vighne swar\My Documents\My Pictures\vighne sh.jpg"
Dim byte1 As Byte() = encoding.GetByt es(postdata)
myWebRequest.Co ntentLength = postdata.Length
Dim newStream As Stream = myWebRequest.Ge tRequestStream( )
newStream.Write (byte1, 0, byte1.Length)
newStream.Close ()
Dim myWebResponse As WebResponse = myWebRequest.Ge tResponse()
Dim Rsr As New StreamReader(my Response.GetRes ponseStream(),
System.Text.Enc oding.Default)
Dim SResponse As String
SResponse = Rsr.ReadToEnd()
MsgBox(SRespons e)
Catch ex As WebException
If ex.Status = WebExceptionSta tus.ProtocolErr or Then
Dim myWebResponse As HttpWebResponse = ex.Response
MsgBox(mywebres ponse.StatusDes cription)
End Try
Comment