How to get an ASP.NET 2.0 Content Form to submit to a third party web page
Posted on 2009-02-10
I'm a web app that uses Master pages. Most of the pages use nested master pages. With master pages you must have a <form> tag with a runat=server attribute. This causes the page to just post back to itself, works great.
However, I have 1 page in the whole site that needs to post to a third party page, and that page will read some of the controls I have on my page, then auto register someone (one of the fields is an email).
The issue I am having is how do I get the form to post to the third part page.
I've tried this on the Master Page:
<form id="Form1" method="post" runat="server" onsubmit="document.Form1.action='WebForm2.aspx';">
However, that gives me an error on the Form1 part as .NET gives the form some weird ID of aspnetForm. I tried chaning the Form1 part to that, but the page just hangs and does nothing.
I also tried this on the the onClick fo the submit button:
var doc = document.forms;
I see the Hello alert box, but the form still posts back to itself.
Can I do this? I really want the web page to have the same look and feel (thus the Master pages), but it just doesn't seem to work. if I remove the master pages, it works, but then the Look and Feel looks crappy.
Thanks in advance.