W
Wayne P.
I'm working on a shopping cart webapp and I need to perform a form POST of
data to a 3rd party site (a payment processor, StormPay).
I seem to be having problems doing this. I have an image button which when
clicked performs the data validation. After successful validation, I need
the browser to redirect to the payment processer with a form post. How can
I do this?
I have tried a few things, failed. Below were my most 'reasonable
attempts'.
1) Based on the example found at
http://authors.aspalliance.com/stevesmith/articles/netscrape2.asp, I used a
System.Net.WebRequest object, and did successfully POST the data to the
other site, however because the browser does not redirect here, the output
was not seen (other than in my result variable). This of course is not
usable behavior becuase the user needs to see and respond to the output from
the resulting posted data. If I can get the broser to move with the
request, then this is okay - but how?
2) Going back to basics, I thought maybe a response.write would work. Using
the following code failed, as all it did was write the raw code back to the
top of my aspx page.
Response.Write("<form name='StormPay'
action='https://www.stormpay.com/stormpay/handle_gen.php' method='POST'
>")
Response.Write("<input type='hidden' name='test_mode' value='1' >")
'Testing Flag
Response.Write("<input type='hidden' name='generic' value='1' >")
Response.Write("<input type='hidden' name='payee_email' value='" &
System.Configuration.ConfigurationSettings.AppSettings.Get("StormPayAccountE
mail") & "' >")
Response.Write("<input type='hidden' name='product_name' value='" &
strProduct_name & "' >")
Response.Write("<input type='hidden' name='return_URL' value='" &
System.Configuration.ConfigurationSettings.AppSettings.Get("ReturnURL") & "'
>")
Response.Write("<input type='hidden' name='cancel_URL' value='" &
System.Configuration.ConfigurationSettings.AppSettings.Get("CancelURL") & "'
>")
Response.Write("</form>")
Response.Write("<script>")
Response.Write("document.StormPay.submit();")
Response.Write("</script>")
Thanks for the insight,
Wayne P.
data to a 3rd party site (a payment processor, StormPay).
I seem to be having problems doing this. I have an image button which when
clicked performs the data validation. After successful validation, I need
the browser to redirect to the payment processer with a form post. How can
I do this?
I have tried a few things, failed. Below were my most 'reasonable
attempts'.
1) Based on the example found at
http://authors.aspalliance.com/stevesmith/articles/netscrape2.asp, I used a
System.Net.WebRequest object, and did successfully POST the data to the
other site, however because the browser does not redirect here, the output
was not seen (other than in my result variable). This of course is not
usable behavior becuase the user needs to see and respond to the output from
the resulting posted data. If I can get the broser to move with the
request, then this is okay - but how?
2) Going back to basics, I thought maybe a response.write would work. Using
the following code failed, as all it did was write the raw code back to the
top of my aspx page.
Response.Write("<form name='StormPay'
action='https://www.stormpay.com/stormpay/handle_gen.php' method='POST'
>")
Response.Write("<input type='hidden' name='test_mode' value='1' >")
'Testing Flag
Response.Write("<input type='hidden' name='generic' value='1' >")
Response.Write("<input type='hidden' name='payee_email' value='" &
System.Configuration.ConfigurationSettings.AppSettings.Get("StormPayAccountE
mail") & "' >")
Response.Write("<input type='hidden' name='product_name' value='" &
strProduct_name & "' >")
Response.Write("<input type='hidden' name='return_URL' value='" &
System.Configuration.ConfigurationSettings.AppSettings.Get("ReturnURL") & "'
>")
Response.Write("<input type='hidden' name='cancel_URL' value='" &
System.Configuration.ConfigurationSettings.AppSettings.Get("CancelURL") & "'
>")
Response.Write("</form>")
Response.Write("<script>")
Response.Write("document.StormPay.submit();")
Response.Write("</script>")
Thanks for the insight,
Wayne P.