Hi all!
I need to develop an VB.NET app that will make a POST request to an WEB Server.
Actualy, i have an ASP Script as an example of how could i be this post to my web server. The ASP code is show below:
<%
' Server URL, HTTPS
const strTangramURL = "
https://tangram/scripts/tangram.asp"
' Service Code
const strServiceId = "015"
' User and Password that will be used to authenticate on the WEB Server
const strTangramUser = "user"
const strTangramPwd = "password"
' *********** Mount a XML that will be sent to the server ***********
' recupera o destinatário da mensagem
strDestination = Request("destination")
' recupera o texto da mensagem
strText = Request("text")
' monta a string XML
strXML = _
"<xml version=""1.0"" encoding=""ISO-8859-1"">" & _
"<tangram_request service_id="" & strServiceId & "">" & _
" <send>" & _
" <destination>" & strDestination & "</destination>" & _
" <text>" & strText & "</text>" & _
" </send>" & _
"</tangram_request>"
' *********** envia ao TANGRAM ***********
' carrega a string XML par o componente
Set oDoc = CreateObject("MSXML2.DOMDocument")
oDoc.async = false
oDoc.loadXML strXML
' Here is where we connect to the server.....
Set oHttp = CreateObject("MSXML2.ServerXMLHttp")
oHttp.SetTimeouts 10000, 10000, 10000, 10000
oHttp.open "POST", strTangramURL, False, strTangramUser, strTangramPwd
oHttp.send oDoc
strXML = oHttp.responseText
' *********** Verify the Result***********
' recupera o código de retorno da operação
oDoc.loadXML strXML
strCode = oDoc. selectSingleNode("/tangram_response/
send").att
ributes.ge
tNamedItem
("code").t
ext
if strCode = "0" then
' redireciona para a página de sucesso
Response.Redirect "sucesso.asp"
else
' recupera a descrição do erro
strDescription = oDoc.selectSingleNode("/tangram_resp
onse/send/
descriptio
n").text
' redireciona para a página de erro
Response.Redirect "erro.asp?msg=" & strDescription
end if
Set oDoc = Nothing
Set oHttp = Nothing
%>
So, can anybody shows me convert the ASP code above to a VB.NET method that will do the same thing?
Thanks all!