I need to use a HTTP Post like described below:
- Code: Select all
// Attention: This is not Javascript / Servoy script. This is probably VB .Net
Dim request As HttpWebRequest = CType(WebRequest.Create("https://start.exactonline.nl/docs/XMLDivisions.aspx"), HttpWebRequest)
Dim bFormData As Byte() = Encoding.UTF8.GetBytes("_UserName_=xxx&_Password_=yyy")
request.ContentType = "application/x-www-form-urlencoded"
request.Method = "POST"
request.AllowWriteStreamBuffering = True
Dim reqStream As Stream = request.GetRequestStream()
reqStream.Write(bFormData, 0, bFormData.Length)
reqStream.Close()
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
If response.StatusCode = HttpStatusCode.OK AndAlso _
StrComp(response.ResponseUri.AbsoluteUri, "https://start.exactonline.nl/docs/XMLDivisions.aspx", CompareMethod.Text) = 0 Then
'Login succeeded
Else
'Access denied
End If
The standard Servoy HTTP-Plugin can not handle this, because one of reasons is the request.ContentType = "application/x-www-form-urlencoded"
This has been confirmed by Servoy Support.
Is there anyone who faced the same problem and found a solution to implement a post like this?
Martin