I'm having problems getting something to work that really doesn't appear it should be so hard to do.... it's driving me crazy!
I'm trying to make my site PCI Compliant. Well, that is changing it to connect to a page that is hosted on my gateway that is PCI Compliant for the user to input their credit card information.
The gateway needs for me to send the parameters as "HIDDEN" fields using a "POST". Here is the sample they provided:
[html]
[head]
[ le]XYZ Corporation -- Sample Checkout Page[/ le]
[/head]
[body]
[form name="Form_01" method="POST" action="https://test1.XYZ.com/main.aspx"]
Transaction Amount:[br]
[input type="TEXT" name="TransactionAmount" value="1.00"]
[input type="HIDDEN" name="ECOMRequestID" value="{00000000-0000-0000-0000-000000000000}"]
[input type="HIDDEN" name="PurchaseIdentifier1" value="ORDER-0001"]
[input type="HIDDEN" name="PurchaseIdentifier2" value="123456789"]
[input type="submit" value="Go to Payment Page"]
[/form]
[/body]
[/html]
I created the following code.... It works but only if the "Supports Partial Rendering" is turned off for the module.
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click
Dim FormHTML As StringBuilder = New StringBuilder
Dim HTML As StringBuilder = New StringBuilder
HTML.Append("[script type=""text/javascript""]")
HTML.Append("var newWin = window.open("""", ""NewWin"", ""width=675,height=600,scrollbars=1,resizable=1"");")
HTML.Append(ControlChars.CrLf)
HTML.Append("newWin.document.open();")
HTML.Append(ControlChars.CrLf)
HTML.Append("newWin.document.write('")
FormHTML.Append("[html][head][ le]Test[/ le][/head][body]")
FormHTML.Append("[form name=""AutoForm"" method=""post"" action=""https://test1.xxxxx.com/xxxxx/main.aspx""]")
FormHTML.Append("[input type=""hidden"" name=""TransactionAmount"" value=""1.00"" \/]")
FormHTML.Append("[input type=""hidden"" name=""ECOMRequestID"" value=""{xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx}"" \/]")
FormHTML.Append("[input type=""hidden"" name=""PurchaseIdentifier1"" value=""ORDER-0006"" \/]")
FormHTML.Append("[input type=""hidden"" name=""PurchaseIdentifier2"" value=""Customer #6"" \/]")
FormHTML.Append("[\/form]")
FormHTML.Append("[SCRIPT type=""text/javascript""]document.AutoForm.submit();[\/SCRIPT]")
FormHTML.Append("[\/body][\/html]")
HTML.Append(FormHTML.ToString)
HTML.Append("');")
HTML.Append(ControlChars.CrLf)
HTML.Append("newWin.document.close();")
HTML.Append(ControlChars.CrLf)
HTML.Append("[/SCRIPT]")
Response.Write(HTML.ToString)
End Sub
I have asked a few others and they have said that "best option for you is to render your script to the client within your module. Add a click handler in the javascript, that executes the script." I'm really not sure how to do this.
I found this article on CodeProject (
http://www.codeproject.com/KB/aspne...ost.aspx). This appears to be a nice solution, however, when the "page.Controls.Add(new LiteralControl(strForm))" line is run, I get an error: "The Controls collection cannot be modified because the control contains code blocks (i.e. [% ... %])."
I'm guessing that I'm making this harder than it really should be..... Thanks for any help!
** Note: changed < > to [ ]