Reply
Member
Posts: 1
Registered: ‎12-07-2009

ASP.Net Relay Response?

Ok, so I've done searches on the forums and it seems that either a) most people haven't gotten a thorough response or b) there really is no response to this question.

 

When receiving a relay response, my asp classic code works fine... And when I code up a page to accept this same information in asp.net, it does not. My question is this: Is it not possible to use .net to accept the relay response? The only code provided for relay response is asp classic (which is what I ran the test with). It works great; however, I don't code in asp classic. :) It'd be nice to actually be able to use this data returned in a method that is not implimented in classic. Is my only option to accept the data with the classic code and send that data to another page?

 

Any help is greatly appreciated.

Member
Posts: 3
Registered: ‎11-30-2009

Re: ASP.Net Relay Response?

I am having the same issue and could not find anything in the forums.

 

The way I got around it but not a pretty solution was what you are talking about. I basically used their example and created a classic asp page to receive the relay_response back. Then I built (response.write) a form to pass the data to an asp.net form to process the information (save to db and create email reply).

It works fine, except having an issue with FireFox (another post).

 

It would be nice to be able to skip that step.

Member
Posts: 1
Registered: ‎01-02-2010

Re: ASP.Net Relay Response?

Imports System.Data.SqlClient

Partial Class PaymentResponse
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim x_cust_id As String
        Dim x_response_code As String
        Dim x_response_subcode As String
        Dim x_response_reason_code As String
        Dim x_response_reason_text As String
        Dim x_auth_code As String
        Dim x_invoice_num As String
        Dim x_trans_id As String
        Dim strEventID As String
        Dim strRegID As String

        '*** (Get the Payment Information from Authorization.Net) ***
        x_cust_id = Request.Form("x_cust_id")
        x_response_code = Request.Form("x_response_code")
        x_response_subcode = Request.Form("x_response_subcode")
        x_response_reason_code = Request.Form("x_response_reason_code")
        x_response_reason_text = Request.Form("x_response_reason_text")
        x_auth_code = Request.Form("x_auth_code")
        x_invoice_num = Request.Form("x_invoice_num")
        x_trans_id = Request.Form("x_trans_id")

        '*** (insert the log record indicating a payment was received) ***
        SDS_PaymentResponseLog.InsertParameters("PR_Data").DefaultValue = "Response Received: " & Now & "Customer ID: " & x_cust_id & " " & Request.Form.ToString
        SDS_PaymentResponseLog.Insert()

Member
Posts: 9
Registered: ‎06-09-2010

Re: ASP.Net Relay Response?

Hi, I'm having the same problem with ASP.NET, but I can't find any example of how to do this, mixing classic ASP and ASP.NET. I never used classic ASP before and I don't know where to start. I looked at the Authorize examples in the Relay Response Section (the classic ASP example), but I don’t know how to pass that data to a ASP.NET form.

Can you provide me some direction for me to look? Any help will be appreciated.

Posts: 1,476
Topics: 33
Kudos: 34
Solutions: 126
Registered: ‎09-14-2009

Re: ASP.Net Relay Response?

First let me say that I am not a ASP.NET programmer so I cannot explain things in a technical way. However, all relay response does is send a POST request to a page and then take the results of that rerquest and print them to the screen for the user to see. So, all your ASP.NET page needs to do is handle the POST request, which is the same as a Silent Post request and output a recipt/confirmation to your users. It's really no different then handling a standard form submission.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
Member
Posts: 9
Registered: ‎06-09-2010

Re: ASP.Net Relay Response?

Hi John,

 

Thank you for answer. I’m having a hard time with this issue and any help is appreciated.

 

I have a very simple ASP.NET form as a relay response page. The only thing it does (for testing purposes) is to take the values received and put them in string variables, that’s all, no database access, no email sending, etc.

 

That works fine in test mode (testMode=”TRUE”) but as soon as I change to real mode (testMode=”FALSE”) I get this message when I click the Submit button in the payment form:

 

“An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

      This transaction has been approved.

It is advisable for you to contact the merchant to verify that you will receive the product or service.”

 

Additionally I receive an email with this message:

 

“Your script timed out while we were trying to post transaction results to
it.
   Transaction ID: xxxxxxxxx
Transaction Result: This transaction has been approved.”

 

I get this error 2 or 3 seconds after clicking the submit button in the payment form, so I think the problem is not a real time out, taking in account the simplicity of my page and the fact that it does work in test mode.

 

I talked to Authorize’s tech support and the person who spoke with me told me that I should use classic ASP in the relay response page, not ASP.NET. Maybe the problem has other causes but for now I don’t know what to do.

 

I’m aware of the fact you are not an ASP programmer, but I put here the code anyway, because is so simple. And maybe you can see something I missed. Thanks again.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona l.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

  <title>Authorize</title>

 

 </head>

<body>

  <form id="form1" runat="server">

    Loading...

  </form>

</body>

</html>

 

Partial Public Class RespuestaAuthorize

  Inherits System.Web.UI.Page

 

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

 

    'Response.Expires = 0

 

    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 s_x_response_subcode As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_response_subc ode")) Then

      s_x_response_subcode = Request.Form("x_response_subcode")

 

    End If

 

    Dim n_x_response_reason_code As Integer = 0

 

    If Not String.IsNullOrEmpty(Request.Form("x_response_reas on_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_reas on_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_avs_code As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_avs_code")) Then

      s_x_avs_code = Request.Form("x_avs_code")

 

    End If

 

    Dim n_x_trans_id As Integer = 0

 

    If Not String.IsNullOrEmpty(Request.Form("x_trans_id")) Then

      n_x_trans_id = CInt(Request.Form("x_trans_id"))

 

    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

 

    Dim s_x_method As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_method")) Then

      s_x_method = Request.Form("x_method")

 

    End If

 

    Dim s_x_type As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_type")) Then

      s_x_type = Request.Form("x_type")

 

    End If

 

    Dim s_x_cust_id As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_cust_id")) Then

      s_x_cust_id = Request.Form("x_cust_id")

 

    End If

 

    Dim s_x_first_name As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_first_name")) Then

      s_x_first_name = Request.Form("x_first_name")

 

    End If

 

    Dim s_x_last_name As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_last_name")) Then

      s_x_last_name = Request.Form("x_last_name")

 

    End If

 

    Dim s_x_company As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_company")) Then

      s_x_company = Request.Form("x_company")

 

    End If

 

    Dim s_x_address As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_address")) Then

      s_x_address = Request.Form("x_address")

 

    End If

 

    Dim s_x_city As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_city")) Then

      s_x_city = Request.Form("x_city")

 

    End If

 

    Dim s_x_state As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_state")) Then

      s_x_state = Request.Form("x_state")

 

    End If

 

    Dim s_x_zip As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_zip")) Then

      s_x_zip = Request.Form("x_zip")

 

    End If

 

    Dim s_x_country As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_country")) Then

      s_x_country = Request.Form("x_country")

 

    End If

 

    Dim s_x_phone As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_phone")) Then

      s_x_phone = Request.Form("x_phone")

 

    End If

 

    Dim s_x_fax As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_fax")) Then

      s_x_fax = Request.Form("x_fax")

 

    End If

 

    Dim s_x_email As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_email")) Then

      s_x_email = Request.Form("x_email")

 

    End If

 

    Dim de_x_tax As Decimal = 0

 

    If Not String.IsNullOrEmpty(Request.Form("x_tax")) Then

      de_x_tax = CDec(Request.Form("x_tax"))

 

    End If

 

    Dim de_x_duty As Decimal = 0

 

    If Not String.IsNullOrEmpty(Request.Form("x_duty")) Then

      de_x_duty = CDec(Request.Form("x_duty"))

 

    End If

 

    Dim de_x_freight As Decimal = 0

 

    If Not String.IsNullOrEmpty(Request.Form("x_freight")) Then

      de_x_freight = CDec(Request.Form("x_freight"))

 

    End If

 

    Dim s_x_tax_exempt As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_tax_exempt")) Then

      s_x_tax_exempt = Request.Form("x_tax_exempt")

 

    End If

 

    Dim s_x_po_num As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_po_num")) Then

      s_x_po_num = Request.Form("x_po_num")

 

    End If

 

    Dim s_x_MD5_Hash As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_MD5_Hash")) Then

      s_x_MD5_Hash = Request.Form("x_MD5_Hash")

 

    End If

 

    Dim s_x_cvv2_resp_code As String = ""

 

    If Not String.IsNullOrEmpty(Request.Form("x_cvv2_resp_cod e")) Then

      s_x_cvv2_resp_code = Request.Form("x_cvv2_resp_code")

 

    End If

 

  End Sub

 

End Class

Posts: 1,476
Topics: 33
Kudos: 34
Solutions: 126
Registered: ‎09-14-2009

Re: ASP.Net Relay Response?

This is usually the result of an error in the page. The first thing you need to do for testing is submit a fake POST request directly to you relay response page so you can see the results in web browser. If there is an error you should see it there.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
Member
Posts: 9
Registered: ‎06-09-2010

Re: ASP.Net Relay Response?

I already did that, using your script at

http://www.johnconde.net/blog/all-about-authorize-nets-silent-post/

It works without errors. It also works in test mode. Just did not work in real mode. Did you see all I do is to store the values I receive in string variables? How can that throw a time out error?

Member
Posts: 9
Registered: ‎06-09-2010

Re: ASP.Net Relay Response?

I'm really sorry. It was my mistake: I was trying to cast the value of x_trans_id to Integer and that produced the error, it never happened in test mode because in that mode x_trans_id is always 0. I got confused by the error message from Authorize, the real problem was not related to a time out error.

 

So if you are having a time out message before the 10 seconds Authorize will wait to really throw a time out error, chances are that the problem is really an error in your code.

 

 

Contributor
Posts: 11
Registered: ‎01-27-2011

Re: ASP.Net Relay Response?

I'm getting the same error.  No errors when I send a test post to the page.  I've even removed every line of code and I still get the errors.