cancel
Showing results for 
Search instead for 
Did you mean: 

SIM Integraion - asp.net- Silent Post - Urgent Plz

Guys,

 

I am trying to use ASP.net integration with Auth.Net.. Trying to use Silent Post url by setting the silent post url value to my aspx link in my Authrize.net account. Load event of the page is not getting called . I am using the receipt_LINK method = "LINK". Did not work!! Nothing happens...

 

If I am using the  receipt_LINK method = "POST" I amgetting the below error:

 

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster

 

 

My payment form and receipt form is with Authorize.Net. I want to save the transaction details after the completion wile navigates back to my URL.

 

Please Help!!  Urgent Plz..

 

Thanks...

-K

krishnakolluru
Contributor
24 REPLIES 24

Yes Sir!

Relay and Silent post did not work.

 

Post from the receipt page:

If Link method = Link - didnot work.

if Link method = post - Machine ley error came. though I kept EnableViewStateMac="false"!

 

My scenario again is:

I am using Auth.Net's payment and their receipt form.

I kept the Silent post url variable in marchants interface to my silent page url.

Also tried to reach the silent page from the receipt page.. using my earlier code. Nothing is written to the log file.

 

Should I have to make any auth.nets variables to false. Any sample code Please!

Thanks a lot!

When does the Silent Post URL gets called! At the time of Submit click on payment form or

when click of return url on receipt form.

 

If it the time of Submit, Do I need to change any other settings other than the Silent post URL in marchants interface?

 

if Link method = post - Machine ley error came. though I kept EnableViewStateMac="false"!

Did you put that in BOTH the SIM form page and the silent post page? If even this is not going thru, there is no point of looking at anything else.

For testing can you just have a static silent post page. e.g. just have the text "hello world" on the page. And down add any logic to the code behind.

 

When does the Silent Post URL gets called! At the time of Submit click on payment form or when click of return url on receipt form.

The silent post is call when the transaction get process on authorize.net but some user report there might be a 5 min delay. If you need the customer click on a url, it is not silent post anymore. But keep it that way for now until we can figure out why it is not working on your site.

 

Hi Ray,

 

I have kept EnableViewStateMAC = false in my Silent form page only. As I am using the payment form and the receipt form Authorize.NET I am not using/having any SIM form page. Please guide me if I am doing wrong. I am a beginner here.

 

I have only the silent form which i have the code given in my previous post.

 

I think I am missing this SIM form. Please help me to proceed further with this! Thanks again!

 

The form that post to https://secure.authorize.net/gateway/transact.dll or https://test.authorize.net/gateway/transact.dll

need to set EnableViewStateMAC = false

 

After that try the receipt post click and see if it go thru.

No luck still... I tried using EnableViewStateMAC = "false" for both TestForm and my SilentForm also...

 

Here is the code I am having:

I created a test form:

TestForm.aspx

<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="TestForm.aspx.cs"Inherits="namespace.TestForm" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headid="Head1"runat="server">

   

<title></title>

   

<linkhref="~/Styles/Site.css"rel="stylesheet"type="text/css"/>

</

head>

<

body>   

<

formid="simForm"runat="server"method='post'action='https://secure.authorize.net/gateway/transact.dll'>

<divclass="main">

  

<inputid="HiddenValue"type="hidden"value="Initial Value"runat="server"/>

       

<inputtype='hidden'runat="server"name='x_login'id='x_login'/>

       

<inputtype='hidden'runat="server"name='x_version'id='x_version'/>

       

<inputtype='hidden'runat="server"name='x_method'id='x_method'/>

       

<inputtype='hidden'runat="server"name='x_amount'  id='x_amount'/>

       

<inputtype='hidden'runat="server"name='x_description'id='x_description'/>

       

<inputtype='hidden'runat="server"name='x_invoice_num'id='x_invoice_num'/>

       

<inputtype='hidden'runat="server"name='x_fp_sequence'id='x_fp_sequence'/>

       

<inputtype='hidden'runat="server"name='x_fp_timestamp'id='x_fp_timestamp'/>

       

<inputtype='hidden'runat="server"name='x_fp_hash'id='x_fp_hash'/>

       

<inputtype='hidden'runat="server"name='x_test_request'id="x_test_request"/>

       

<inputtype='hidden'runat="server"name='x_relay_url'id="x_relay_url"/>

        

<inputtype='hidden'runat="server"name='x_relay_always'id="x_relay_always"/>

       

<inputtype='hidden'runat="server"name='x_cancel_url'id="x_cancel_url"/>

       

<inputtype='hidden'runat="server"name='x_cancel_url_text'id="x_cancel_url_text"/>

       

<inputtype='hidden'runat="server"name='x_receipt_link_URL'id="x_receipt_link_URL"/>

       

<inputtype='hidden'runat="server"name='x_receipt_link_method'id='x_receipt_link_method'/>

       

<inputtype='hidden'runat="server"name="x_receipt_link_text"id='x_receipt_link_text'value="click here to return to our home page"/>

       

<inputtype='hidden'runat="server"name='x_relay_response'id="x_relay_response"/>

       

<inputtype='hidden'name='x_show_form'value='PAYMENT_FORM'/>

      

<table>

        

<tr>

               

<tdcolspan="2"align="center">

                   

<asp:ButtonID="btnSubmit"runat="server"Text="Complete the Purchase"ClientIDMode="Static"CssClass="buttons"Width="200px"/>

               

</td>

           

</tr>

     

</table>

</

div>

</

form>

</

asp:Content>

 

---------------------------------------------TestForm.aspx.cs-----------------

protectedvoid Page_Load(object sender, EventArgs e)

{

        

int applicationId = int.Parse(Session[SessionVariableNames.ApplicationId].ToString());

GetAuthNetInfo(applicationId);

          

 

          

decimal amt = 0.00M;

          

int transactionId = int.Parse(ret.ToString());

 

string postBackURL = ConfigurationManager.AppSettings["AUTH_NET_POSTBACK_URL"];

btnSubmit.PostBackUrl = postBackURL;

            strAuthorizeNet_x_amount =

"0.01";

            strAuthorizeNet_x_login = authNetLogin;

            strAuthorizeNet_x_receipt_link_url =ConfigurationManager.AppSettings["AUTH_NET_RECEIPT_URL"];

            strAuthorizeNet_x_fp_hash = ///code

 

            x_login.Value = strAuthorizeNet_x_login;

            x_version.Value ="3.1";

            x_method.Value ="CC";

            x_amount.Value = strAuthorizeNet_x_amount;

            x_description.Value = description;

            x_invoice_num.Value = nPurchaseID.ToString();

            x_fp_sequence.Value = strAuthorizeNet_x_fp_sequence;

            x_fp_timestamp.Value = strAuthorizeNet_x_fp_timestamp;

            x_fp_hash.Value = strAuthorizeNet_x_fp_hash;

 

            x_receipt_link_method.Value ="Link";

            x_receipt_link_text.Value ="click here to return to our home page";

            x_test_request.Value = "TRUE";

           x_receipt_link_URL.Value =  SilentForm.aspx;

        }

 

------------------------------------------SilentForm.aspx----------------

protectedvoid Page_Load(object sender, EventArgs e)

        {

            

int icount = 0;

             

string data = "Started to write " + DateTime.Now.ToString() + "\n\r";

             

string destPath = System.Web.HttpContext.Current.Server.MapPath("~/bin");

                System.IO.

File.WriteAllText(destPath + "\\SilentPost.txt", data);

                data +=

"   ";

                data += Request.Form.Count.ToString();

                data += Request.QueryString.Count.ToString();

             

while (icount < Request.Form.Count)

                {

                    data = data + Request.Form[icount].ToString() +

"\n\r";

                    icount++;

                }

                data +=

"**********DONE**********";

                System.IO.

File.AppendAllText(destPath + "\\SilentPost.txt", data);

}

I don't see where you set EnableViewStateMAC="false" on your 

TestForm.aspx

<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="TestForm.aspx.cs"Inherits="namespace.TestForm" %>

I removed it when I copied the code....I kept it in both the test and silent form also...and did not work...

 

%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="TestForm.aspx.cs"Inherits="namespace.TestForm" ...

 

My application is in HTTP... that should not matter right... it need not be in HTTPS?

What is this?

  x_receipt_link_URL.Value =  SilentForm.aspx;

 

Need to be "Post", "Link" will never work.

x_receipt_link_method.Value ="Link";

 

So even if you have EnableViewStateMAC="false" on both those pages. It it still getting

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster

 

When you click on "click here to return to our home page"