这是使用VB.NET的POST方法请帮助我有错误。我得到400错误,“远程服务器返回错误:(400)错误请求”.....我的方法如下....
Public Function Linked_DataApi_Call(ByVal RequestUrl As String) As String
Try
Dim request As WebRequest = WebRequest.Create(RequestUrl)
request.Credentials = CredentialCache.DefaultCredentials
request.Method = "PUT"
/*Here am getting error:"The remote server returned an error: (400) Bad Request"*/
Dim response As WebResponse = request.GetResponse
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
Dim dataStream As Stream = response.GetResponseStream
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd
Return responseFromServer
Catch ex As Exception
Return ex.Message
End Try
End Function