cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read Relay Response POST Data in ASP.NET

I am using SIM, trying to get relay_response to work on a test account with an ASP.NET 2.0 application.  It is displaying the response URL page fine, but there is no data displayed... it's as if there was no form data posted to it at all, the same as if you just typed in the URL.

 

However, when I use https://developer.authorize.net/tools/paramdump/ as the response url I can see the posted data, so I know the problem is probably not with Authorize.net.  However, when I post to my response page from a test page, it does recognize and display the posted data, so I know the page is handling the posted data correctly.  

This is the test page that DOES work... the response page does display the posted data:

 

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
<form id="form1" runat="server"  method='post' action="http://localhost/www.faea.org/FAEAWeb/TransSuccess.aspx">
<input type='hidden' runat="server" name='x_response_code' id='x_response_code' value="1" />
<input type='hidden' runat="server" name='x_response_reason_text' id='x_response_reason_text' value='Test response reason text' />
<input type='hidden' runat="server" name='x_description' id='x_description' value="Test Description" />
<input type='submit' runat="server" id='buttonLabel' />
</div>
</form>
</body>
</html>

 

But for some reason, whenever Authorize.net posts to my response page after a transaction, the page comes up but with none of the POST data.  

 

I have disabled viewStateMAC in the Page directive.  I'm not behind a firewall other than the Windows 7 firewall.  I'm running IIS 7 and the application is using ASP.NET 2.0.   I'm not getting any error messages anywhere, it's just displaying my response page with all the data fields empty. 

 

Here is my ASP.Net script that is handling the relay response page:

 

 

 

  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Response.Expires = 0  '--I've tried with and without the Response.Expires

            Dim s_x_response_code As String = ""
            If Not String.IsNullOrEmpty(Request.Form("x_response_code")) Then
                s_x_response_code = Request.Form("x_response_code")
            End If

            Dim n_x_response_reason_code As Integer = 0
            If Not String.IsNullOrEmpty(Request.Form("x_response_reason_code")) Then
                n_x_response_reason_code = CInt(Request.Form("x_response_reason_code"))
            End If

            Dim s_x_response_reason_text As String = ""
            If Not String.IsNullOrEmpty(Request.Form("x_response_reason_text")) Then
                s_x_response_reason_text = Request.Form("x_response_reason_text")
            End If

            Dim s_x_auth_code As String = ""
            If Not String.IsNullOrEmpty(Request.Form("x_auth_code")) Then
                s_x_auth_code = Request.Form("x_auth_code")
            End If

            Dim s_x_invoice_num As String = ""
            If Not String.IsNullOrEmpty(Request.Form("x_invoice_num")) Then
                s_x_invoice_num = Request.Form("x_invoice_num")
            End If

            Dim s_x_description As String = ""
            If Not String.IsNullOrEmpty(Request.Form("x_description")) Then
                s_x_description = Request.Form("x_description")
            End If

            Dim s_x_amount As String = ""
            If Not String.IsNullOrEmpty(Request.Form("x_amount")) Then
                s_x_amount = Request.Form("x_amount")
            End If

            If s_x_response_code = "1" Then
                UpdateTransaction(s_x_invoice_num)
                lblDescription.Text = "TRANSACTION APPROVED!! <BR /> A receipt has been sent to the e-mail address you provided on the previous screen.<br /><br />" & _
                    s_x_description & "<br />Total Amount: " & s_x_amount & "<br />Approval Code: " & s_x_auth_code
            Else
                lblDescription.Text = "YOUR CARD HAS BEEN DECLINED!!!!<BR />" & s_x_response_code & "<br />" & s_x_response_reason_text & "<br /><br />"
               
            End If
        End Sub

 

 

In searching these forums, I found that someone was told by Authorize.net support that you can't use ASP.NET with Relay Response, you have to use classic ASP (which I really don't want to do), but others have gotten it to work using EnableViewStateMAC="false" so I do have hope that this is possible and there is just something else that I haven't thought about yet.

 

Any help would be greatly appreciated!!!!

 

 

joshbula99
Contributor
46 REPLIES 46

Could it be an IIS issue?  ... windows firewall issue? ... I've Googled this to death for the last 3 days and can't find a solution....  does anyone have ANY ideas to even begin to troubleshoot this?

joshbula99
Contributor

It is trying to relay response to localhost?

 

No, the x_relay_url is accessible from the public internet.  The "localhost" in the code above was just a test page that I made to make sure my relay page does accept post data.  I also have been able to run that test page from other computers on other networks to the public url and it works fine.... just not when Authorize.net tries to post to it.  

When you said nothing on the POST data, do you mean lblDescription is blank or are you looking at the POST data in thing like Fiddler or firebug?

lblDescription is blank where the variables are supposed to be.  

 

When I set the relay response to the parameter dump url (https://developer.authorize.net/tools/paramdump/), I can see the POST data.  

 

Fiddler is only letting me see outgoing data, not incoming posts or requests to the machine, so I'm not sure I have Fiddler configured correctly since Authorize.net goes to the response url in the background then returns just the page to the browser with it's own URL.  So, in Fiddler I'm only seeing the POST data sent to them with the credit card payment info, and the HTML rendered by Authorize.net of my response page, not the actual post data that caused my response page to be rendered... which I think is what is supposed to happen???

So, all you get is "YOUR CARD HAS BEEN DECLINED!!!!..."?

 

Had you check to see if it get redirect because of AspxAutoDetectCookieSupport?

That might be it... I have cookieless="UseCookies" set in sessionState and formsAuthentication parts of the web.config, but when I do a Request.Url in the response page it still has the "AspxAutoDetectCookieSupport=1" at the end of the URL.  I've even disabled SessionState and ViewState for that page.  What else could be causing it to redirect like that?

Mine is cookieless="false" on the sessionState, not sure about formsAuthentication since we do custom authentication.