1
System.Net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse() at refill.btnRequestRefill_Click(Object sender, EventArgs e)内部サーバーエラー(500)httpwebrequest
フォームを送信しようとするとこのエラーが発生します。ここに私のコードです:
Protected Sub btnRequestRefill_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRequestRefill.Click
Try
Dim url As String = "www.domainname.com"
url += "lastName=" & LastName.Text
url += "&birthDate=" & Birthdate.Text
url += "&RxNumbers=" & RxNumber.Text
url += "&deliveryMethod=" & deliverymethod.SelectedValue
url += "&phone=" & PhoneNumber.Text
url += "&email=" & Email.Text
Dim myrequest As HttpWebRequest = TryCast(WebRequest.Create(url), HttpWebRequest)
Dim docresponse As WebResponse = myrequest.GetResponse()
Dim responsestream As Stream = docresponse.GetResponseStream()
Dim objXMLDoc As New XmlDocument()
Dim colElements As XmlNodeList
Dim colElements2 As XmlNodeList
Dim mywebclient As New WebClient()
Dim a As Object
Dim listingscount As Integer = 0
objXMLDoc.Load(responsestream)
colElements = objXMLDoc.GetElementsByTagName("script")
For Each objnode As XmlNode In colElements
Dim attCol As XmlAttributeCollection = objnode.Attributes
If objnode.Name = "script" Then
If attCol(0).Value = "false" Then
colElements2 = objXMLDoc.GetElementsByTagName("rxResponse")
For Each objnode2 As XmlNode In colElements2
Response.Write("<br/>" & objnode2.InnerText & "<br/>")
Next
Else
Response.Write("<br/>yay it when through<br/>")
Dim redir, mailto, mailfrom, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode
subject = "Refill Submit - test"
usetemplate = False
Dim msg = Server.CreateObject("CDO.Message")
msg.subject = subject
msg.to = "[email protected],[email protected],[email protected]"
msg.from = "[email protected]"
For Each item In Request.Form
Select Case item
Case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode", "__EVENTTARGET", "__EVENTARGUMENT", "__VIEWSTATE", "__EVENTVALIDATION", "btnRequestRefill","__LASTFOCUS"
Case Else
If Not usetemplate Then
If item <> "mailfrom" Then body = body & item & ": " & Request.Form(item) & vbCrLf & vbCrLf
Else
body = Replace(body, "[$" & item & "$]", Replace(Request.Form(item), vbCrLf, "<br>"))
End If
End Select
Next
If usetemplate Then 'remove any leftover placeholders
Dim rx As New Regex("\[\$.*\$\]")
body = rx.Replace(body, "")
End If
If usetemplate And LCase(Request.Form("html")) = "yes" Then
msg.htmlbody = body
Else
msg.textbody = body
End If
msg.send()
msg = Nothing
End If
Else
Response.Write("<br/>" & "not script" & "<br/>")
End If
'Response.Write("<br/>" & objnode.Name & ": " & objnode.InnerText & "<br/>")
Next
Catch ex As Exception
Response.Write("<br/>" & ex.ToString & "<br/>")
End Try
End Su
リモートサーバーエラーの詳細を取得する方法はありますか?そして、あなたが得ようとしているURLが有効であることは確かですか?あなたの例から、あなたは有効なURLを提供しているようには見えません。 – Oded
私は顧客に機密理由のためにURLを変更しなければならなかった –