cancel
Showing results for 
Search instead for 
Did you mean: 

DPM - Custom Receipt Page

I am using ASP .NET and have everything working up to the point of the receipt page. I took the asp example and converted it to .NET but I get a "Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.<br>Inner: Object reference not set to an instance of an object." when accessing the Request.Form variables.

 

Any ideas?

sands904
Contributor
28 REPLIES 28

I always put my code in code behind, so I'm not so sure how it might be different on a single page.

I typically do also, but it was easier to modify the asp to .net by leaving it in one file. So, any ideas on what the issue is?

No idea, but I do know it works if the Request.Form is in code behind.

 

And I haven't found anything with the <% some codes %> in asp.net

Okay I will try moving things to the code behind. I was trying to avoid having any server controls in any of the Auhtorize .NET pages. The examples I saw said to avoid this for DPM at least for the page gathering the credit card information because of PCI compliance. I am guessing that that is not an issue on the receipt/relay page since the card information has already been sent, right?

The examples I saw said to avoid this for DPM at least for the page gathering the credit card information because of PCI compliance. I am guessing that that is not an issue on the receipt/relay page since the card information has already been sent, right?

Correct. Authorize.net capture all the CC info, so you don't have to.

Okay well i tried in the code behind and I still get the object reference error...I really need to get this working...any other ideas??

 

The main part of the page is still the same except I pulled the population of the variables into the page_load method

 

    protected void Page_Load(object sender, EventArgs e)
    {
        //Response.Expires = 0;

        // Retrieving and defining Form Data from Post command body from Authorize.Net
        sResponseCode = Request.Form["x_response_code"].Trim();
        sResponseReasonText = Request.Form["x_response_reason_text"].Trim();
        sResponseReasonCode = Request.Form["x_response_reason_code"].Trim();
        sAVS = Request.Form["x_avs_code"].Trim();
        sTransID = Request.Form["x_Trans_ID"].Trim();
        sAuthCode = Request.Form["x_Auth_Code"].Trim();
        sAmount = Request.Form["x_Amount"].Trim();
        sReceiptLink = "http://www.authorizenet.com";
        sDescription = "description";
        sInvoiceID = "1";
        sBillingInfo = "John Doe<br />123 Main St<br />Somewhereville, XX 99999<br />email@email.com<br />555-555-5555";    
    }

This it from my relay response test page to check the post values.

protected void Page_Load(object sender, EventArgs e)
{
	foreach (string key in Request.Form)
	{
		Label1.Text += key + ",";
		Label2.Text += Request.Form[key] + ",";
	} 
}

 As you can see it only have 2 label, Label1 and Label2. And I just run it again and make sure it works.

I tried that and got nothing. So I tried the following and get 0 - as in NONE. Why am I not getting anything back??? Really need to get this working ;)

 

lit1.Text = Request.Form.Count.ToString();

It this the relay response page(where you have the URL set on the merchant account) or it is redirect from some another page?

It is the receipt page as sent in the confirmation page (where the client enters their card info).

 

Confirm.aspx - where the client enters their info

 

strAuthorizeNet_x_relay_response = "TRUE";
strAuthorizeNet_x_relay_url = "https://" + Request.Url.Host + "/Public/Authorize/SIM.aspx";
strAuthorizeNet_x_receipt_link_url = "https://" + Request.Url.Host + "/Public/Authorize/Thanks.aspx";

SIM.aspx

 

Response.Redirect("/Public/Authorize/Thanks.aspx");


AHHHH....after pasting this...duh! That is what I get for copying someone else's example and tweaking it.

 

So, then how do I display a receipt to the client? I have everything working as I want it except that part. Can I redirect back to the default Authorize .NET receipt page at that point?