500 Internal Server Error

G

Guest

I get the following error when I send a HTTPWebRequest.

System.Net.WebException: The remote server returned an error: (500) Internal
Server Error. at System.Net.HttpWebRequest.CheckFinalStatus() at
System.Net.HttpWebRequest.GetResponse()

Below is the code that I wrote.
-------------------------------------

Dim xmlDOM As New XmlDocument

xmlDOM.Load("C:/Subs_Req.xml")

Dim strxml As String = xmlDOM.OuterXml
Dim myxml As String = "xml=" & strxml
Dim data() As Byte = System.Text.Encoding.UTF8.GetBytes(myxml.ToString())
Dim xml As String = System.Web.HttpUtility.UrlEncode(myxml)
Dim myURL As String= "https://xxxxxx.com:443/xxxx".ToString
Dim myRequest As HttpWebRequest = CType(WebRequest.Create(myURL),
HttpWebRequest)

myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
myRequest.ContentLength = data.Length
Dim NewStream As Stream = myRequest.GetRequestStream()

NewStream.Write(data, 0, data.Length)
NewStream.Close()
Dim myResponse As HttpWebResponse
myResponse = CType(myRequest.GetResponse(), HttpWebResponse)

Dim sr As StreamReader = New StreamReader (myResponse.GetResponseStream())
Dim response As String = sr.ReadToEnd()
 
W

Ward Bekker

Hi Beginner,

It seems that the post to the page on the remote server caused a 500
Server Error, meaning that an exception occured. Re-check if you are
posting the correct data, otherwise the receiving page is not programmed
correctly and needs to be corrected.

--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
 
G

Guest

Thanks for the response.

When I post the same information to a local server it just works fine. But
not to this. Mine is a simple asp.net app. The receiving page is also fine.
Do you think the external url being https could cause this problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top