0

I am trying to send some data from one asp page to another. I've tried using the code below, and although I don't have any compilation errors, my request.aspx page does not seem to be receiving the data. What is going wrong?

ASP page sending data:

Dim objHttp 
Dim str 

str = "request=Test" 

Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
objHttp.Open "POST", "https://address.com/request.aspx", false
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1"
objHttp.setRequestHeader "Content-Length", Len(str) 
objHttp.Send str 

Response.Write(objHttp.ResponseText) 

Set objHttp = nothing

ASPX page receiving data:

Imports System.IO
Imports System.Threading

Partial Class request

Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

    Dim CurrentUser As MembershipUser = Membership.GetUser()
    Dim contentRequest As String = Context.Request.Form("request")

    'do something

End Sub
End Class
  • What do you see in the browser network trace window when your asp page makes the request ? Any error returned ? – sh1rts May 13 '14 at 23:22

1 Answers1

0

My friend, i think that is something with "HTTPS".

This is my code, that is working.

<%
    DataToSend = "id=1"

    dim xmlhttp 
    set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
    xmlhttp.Open "POST","http://localhost/Receiver.aspx",false
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlhttp.send DataToSend

    Set xmlhttp = nothing
%>

But, take a look into that posts:

Can't use HTTPS with ServerXMLHTTP object

Getting XMLHTTP to work with HTTPS

Community
  • 1
  • 1
MarceloBarbosa
  • 915
  • 16
  • 29