We help IT Professionals succeed at work.
Get Started

How to get an ASP.NET 2.0 Content Form to submit to a third party web page

WaldaInc asked
Last Modified: 2012-05-06

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:

       function valSubmit()  
            var doc = document.forms[0];

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.
Watch Question
Digital Marketing (Hospitality)
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE