我想問怎樣可以同VB.NET 去 SEND REQUEST 到 HTTPS XML INTERFACE?
我需要 用HTTP HEADER 去LOGIN 這個 HTTPS
下面是 果個 XML INTERFACE DEVELOPER GUILD 中其中幾個我不是大明白怎樣做的地方
Authentication on incoming HTTPS requests will be basic user ID/Password authentication.
HTTP Method: Post HTTP Body Input Stream: $xml-request-data
Authentication: Basic User: user Password:password Header Content-Type : text/xml
當我嘗試IMPLEMENT 一個FUNCTION 來試下POST HTTP HEADER 去 PASS AUTHENTICATION 時 It returns the following Error/Exception WebException was unhandled "The remote server returned an error:(403) Forbidden" 希望大家可以教教我
以下是我 做的CODE 希望大家可以話給我聽 我在那裡做錯了 謝謝大家
Public Sub Test() Dim req As WebRequest = WebRequest.Create("https://acompanyXMLInterface.net/") req.Method = "POST" req.ContentType = "text/xml req.Headers.Add(HttpRequestHeader.Authorization, "Basic " + Convert.ToBase64String(New UTF8Encoding().GetBytes("username:password")))
Dim rsp As HttpWebResponse
rsp = req.GetResponse '<-- WebException was unhandled "The remote server returned an error:(403) Forbidden" req.GetRequestStream.Close() rsp.GetResponseStream.Close()