• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

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


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.
1 Solution
David H.H.LeeCommented:
Hi WaldaInc,
Try using post the form via button's PostBackUrl property
<form id="Form1" method="post" runat="server">
<asp:Button ID="btnSubmit" runat="server" PostBackUrl="https://www.yourdomain.com/WebForm2.aspx" Text="  Submit  " /><
WaldaIncAuthor Commented:
Yep, I found that out too (page 5 of the Google search). Thanks for posting this, was going to close it tomorrow moring.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now