Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Invalid Postback or CallBack for Payment Gateway form

Posted on 2007-10-20
4
Medium Priority
?
757 Views
Last Modified: 2013-11-29
Can anybody help me sort out why I am always getting this error
I've already tried to everything I have researched about this error,
but not getting anywhere yet.
Some thing needs tweaking. Can you advise ?

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +261
   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +83
   System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) +89
   System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +36
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +479
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2549

The page looks like this

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="BuyMorePoints.aspx.vb" Inherits="SecureUser_BuyMorePoints" title="Untitled Page"   %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<h3>Buy More Points</h3>

    <p align=center>
        Purchase here by credit card using DirectOne secure payment gateway
    <br />
    Select the button for the amount /points required
    </p>
   
    <p align=center>
    <asp:DropDownList ID="DropDownList1" runat="server" >
        <asp:ListItem Value="20">2000 points for $20</asp:ListItem>
        <asp:ListItem Value="50">5000 points for $50</asp:ListItem>
        <asp:ListItem Value="100" Selected="True">10000 points for $100</asp:ListItem>
        <asp:ListItem Value="300">30000 points for $300</asp:ListItem>
    </asp:DropDownList>
    </p>
     
    <br />

<form name=form1 method=POST
action="https://vault.safepay.com.au/cgi-bin/test_payment.pl">
 
  <table width="800" border="0" align="center">
     
    <tr>
      <td>
        <input type=Hidden name=vendor_name value=businessname>
        <input type=Hidden name=currency value=$>
      </td>
    </tr>
 </table>
 
 <table align="center">
    <tr>
      <td>Name: </td>
      <td>
        <input type=Text name=Name size=30>
      </td>
    </tr>
   
    <tr>
      <td>Address Line 1: </td>
      <td>
        <input type=Text name=Address size=30>
      </td>
    </tr>
   
    <tr>
      <td>Address Line 2: </td>
      <td>
        <input type=Text name=Address2 size=30>
      </td>
    </tr>
   
    <tr>
      <td>City: </td>
      <td>
        <input type=Text name=City size=30>
      </td>
    </tr>
   
    <tr>
      <td>State: </td>
      <td>
        <input type=Text name=State size=30>
      </td>
    </tr>
   
    <tr>
      <td>Zip / Postal Code: </td>
      <td>
        <input type=Text name=Zip size=30>
      </td>
    </tr>
   
    <tr>
      <td>Country: </td>
      <td>
        <input type=Text name=Country size=30>
      </td>
    </tr>
   
  </table>
 


  <table width="500" border="5" align="center">
    <tr>
      <td align=CENTER>Amount to be paid:</td>
      <td align=CENTER>$<input type=Text name=Account_Payment value=DropDownList1.SelectedValue size=10>
      </td>
    </tr>
  </table>
 
  <p align=center>
 <!--
-------------------------------------------------------------------------------
 these fields will appear on the invoice as general information about
the customer, examples would be their name, address, contact number, email, and so
on.
--------------------------------------------------------------------------------
-->
 <input type=Hidden name=information_fields  
 value="Name,
        Addr1,
        Addr2,
        Addr3,
        City,
        State,
        PostCode,
        Country">
 <!--
-------------------------------------------------------------------------------
 If you want the information from a field to appear on the invoice but
don't want the actual field name (as it was specified on your form) to also
appear, you can tell the invoice generating script to suppress the field name while
printing the field data.

--------------------------------------------------------------------------------
    <input type=Hidden name=suppress_field_names value="Address2,
        City,
        State,
        Zip,
        Country">
 -------------------------------------------------------------------------------
 If a field is specified as required, it must be filled out by the
customer or the  invoice page will not be generated.

--------------------------------------------------------------------------------
 <input type=Hidden name=required_fields   value="Address,
        City,
        State,
        Zip,
        Country,
        Account_Payment">

-------------------------------------------------------------------------------
 these are fields that are present on the order form (to calculate the
subtotal  that gets sent to DirectOne, but they are not actually wanted on the
form.  Specifying them in this section means the invoice generating script
will ignore  both the field name, and the field data

--------------------------------------------------------------------------------
-->
    <input type=hidden name=gst_rate value=10>
    <input type=Hidden name=print_zero_qty value=false>
   
    <input type=Reset value=Clear>
    <input type=Submit value=Submit>
   
</form>

  <div align="center"><font face="Arial, Helvetica, sans-serif">When you press SUBMIT you will be taken to the secure payment page.<i><b></b></i></font></div>
 
  <p align=center>
  <A HREF="http://www.directone.com.au/html/vendor_link.html"/>
                      <img src="http://www.directone.com.au/images/safe_link.gif"; BORDER=0>
  </p>

    <br/>
</asp:Content>

Ths code behing looks like this

Partial Class SecureUser_BuyMorePoints
    Inherits System.Web.UI.Page
   


    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)

        ClientScript.RegisterForEventValidation("DropDownList1", "2000 points for $20")
        ClientScript.RegisterForEventValidation("DropDownList1", "5000 points for $50")
        ClientScript.RegisterForEventValidation("DropDownList1", "10000 points for $100")
        ClientScript.RegisterForEventValidation("DropDownList1", "30000 points for $300")

        MyBase.Render(writer)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack Then
            DropDownList1.DataBind()
        Else
            DropDownList1.DataBind()
        End If
    End Sub
End Class

 
0
Comment
Question by:jaffacat
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
McExp earned 1500 total points
ID: 20114359
I believe your DropdownList needs to be on a form with runat="server" set. If you have a form in your master page you can't nest another form inside it.

Would you be happy to turn off event validation. you could do it just for this page.
0
 

Author Comment

by:jaffacat
ID: 20114534
Prefer not to turn it off, because it's supposed to be for security purpose to validate the form.
I will try to remove this page from the masterpage and see how it goes, and add add runat="server"
0
 

Author Comment

by:jaffacat
ID: 20116056
Hi ... me again
A different problem this time. I have put the new page below, but now when I press submit, it doesn't go off to the DirectOne payment webpage, but postback to my page again clearing the form, apparently having dome nothing. Can you tell why it's doing this ? Also another question ,,, can I get the selected value of the dropdownlist to populate the amount to be paid. The way I'm doing it now doesn't work.
Thanks for your help

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="BuyMorePoints.aspx.vb" Inherits="SecureUser_BuyMorePoints" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
           
<form id="Form1" name=form1 method=POST runat="server" action="https://vault.safepay.com.au/cgi-bin/test_payment.pl">
 
  <h3>Buy More Points</h3>

    <p align=center>
        Purchase here by credit card using DirectOne secure payment gateway
    <br />
    Select the button for the amount /points required
    </p>
   
    <p align=center>
    <asp:DropDownList ID="DropDownList1" runat="server" >
        <asp:ListItem Value="20">2000 points for $20</asp:ListItem>
        <asp:ListItem Value="50" Selected="True">5000 points for $50</asp:ListItem>
        <asp:ListItem Value="100">10000 points for $100</asp:ListItem>
        <asp:ListItem Value="300">30000 points for $300</asp:ListItem>
    </asp:DropDownList>
    </p>
     
    <br />
 
  <table width="800" border="0" align="center">
     
    <tr>
      <td>
        <input type=Hidden name=vendor_name value=businessname>
        <input type=Hidden name=currency value=$>
      </td>
    </tr>
 </table>
 
 <table align="center">
    <tr>
      <td>Name: </td>
      <td>
        <input type=Text name=Name size=30>
      </td>
    </tr>
   
    <tr>
      <td>Address Line 1: </td>
      <td>
        <input type=Text name=Address size=30>
      </td>
    </tr>
   
    <tr>
      <td>Address Line 2: </td>
      <td>
        <input type=Text name=Address2 size=30>
      </td>
    </tr>
   
    <tr>
      <td>City: </td>
      <td>
        <input type=Text name=City size=30>
      </td>
    </tr>
   
    <tr>
      <td>State: </td>
      <td>
        <input type=Text name=State size=30>
      </td>
    </tr>
   
    <tr>
      <td>Zip / Postal Code: </td>
      <td>
        <input type=Text name=Zip size=30>
      </td>
    </tr>
   
    <tr>
      <td>Country: </td>
      <td>
        <input type=Text name=Country size=30>
      </td>
    </tr>
   
  </table>
 


  <table width="500" border="5" align="center">
    <tr>
      <td align=CENTER>Amount to be paid:</td>
      <td align=CENTER>$<input type=Text name=Account_Payment value=DropDownList1.SelectedValue size=10>
      </td>
    </tr>
  </table>
 
  <p align=center>
 <!--
-------------------------------------------------------------------------------
 these fields will appear on the invoice as general information about
the customer, examples would be their name, address, contact number, email, and so
on.
--------------------------------------------------------------------------------
-->
 <input type=Hidden name=information_fields  
 value="Name,
        Addr1,
        Addr2,
        Addr3,
        City,
        State,
        PostCode,
        Country">
 <!--
-------------------------------------------------------------------------------
 If you want the information from a field to appear on the invoice but
don't want the actual field name (as it was specified on your form) to also
appear, you can tell the invoice generating script to suppress the field name while
printing the field data.

--------------------------------------------------------------------------------
    <input type=Hidden name=suppress_field_names value="Address2,
        City,
        State,
        Zip,
        Country">
 -------------------------------------------------------------------------------
 If a field is specified as required, it must be filled out by the
customer or the  invoice page will not be generated.

--------------------------------------------------------------------------------
 -->
 <input type=Hidden name=required_fields   value="Address,
        City,
        State,
        Zip,
        Country,
        Account_Payment">
<!--
-------------------------------------------------------------------------------
 these are fields that are present on the order form (to calculate the
subtotal  that gets sent to DirectOne, but they are not actually wanted on the
form.  Specifying them in this section means the invoice generating script
will ignore  both the field name, and the field data

--------------------------------------------------------------------------------
-->
    <input type=hidden name=gst_rate value=10>
    <input type=Hidden name=print_zero_qty value=false>
   
    <input type=Reset value=Clear>
    <input type=Submit value=Submit>
   

    <p align=center>
        <font face="Arial, Helvetica, sans-serif">When you press SUBMIT you will be taken to the secure payment page.<i><b></b></i></font>
 
 
        <A HREF="http://www.directone.com.au/html/vendor_link.html"/>
                      <img src="http://www.directone.com.au/images/safe_link.gif"; BORDER=0>
    </p>
    <br/>
   
 </form>      
   
</body>
</html>


The code behind now looks like this

Partial Class SecureUser_BuyMorePoints
    Inherits System.Web.UI.Page

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)

        ClientScript.RegisterForEventValidation("DropDownList1", "20")
        ClientScript.RegisterForEventValidation("DropDownList1", "50")
        ClientScript.RegisterForEventValidation("DropDownList1", "100")
        ClientScript.RegisterForEventValidation("DropDownList1", "300")

        MyBase.Render(writer)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim intZero As Integer
        If Page.IsPostBack Then
            intZero = 0
        Else
            DropDownList1.DataBind()
        End If
    End Sub

End Class
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn about the eCommerce marketing trends for the year ahead.
Businesses who process credit card payments have to adhere to PCI Compliance standards. Here’s why that’s important.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
Suggested Courses
Course of the Month20 days, 22 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question