To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Display Modes
Old May 9th, 2005, 05:45 AM   #1
vighneswar
New Member
 
Join Date: May 05
Posts: 1
vighneswar is an unknown quantity at this point (<10)
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
Vighneswar@nannacomputers.com

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
vighneswar is offline   Reply With Quote
Old Jul 1st, 2005, 02:40 AM   #2
jimjamjo
New Member
 
Join Date: Jul 05
Posts: 6
jimjamjo is an unknown quantity at this point (<10)
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
jimjamjo is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic .NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:33 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.