Form Post to Non-ASP.NET Page

J

Jonathan Wood

I raised this issue before and never got anywhere. Thought I'd try again to
see if anyone ever resolved this.

I want to do a FORM POST to a non-ASP.NET page on another site. I can do
this with a regular HTML <form> tag. However, this doesn't work well with
ASP.NET. ASP.NET pages must have the page content within a <form> tag in
order to use ASP.NET controls and handle their events. And, since the HTML
specification does not support nested <form> tags, this means I cannot add
another HTML <form> tag to perform a non-ASP.NET form post.

Ideally, it seems like I should be able to write a normal ASP.NET button
event handler, and have the handler emulate a form post (and redirection).

Unfortunately, I cannot get this to work. This would be a cool trick as
searching the Web found lots of people with the same problem but no
solutions.

Thanks!
 
A

Alexey Smirnov

I raised this issue before and never got anywhere. Thought I'd try again to
see if anyone ever resolved this.

I want to do a FORM POST to a non-ASP.NET page on another site. I can do
this with a regular HTML <form> tag. However, this doesn't work well with
ASP.NET. ASP.NET pages must have the page content within a <form> tag in
order to use ASP.NET controls and handle their events. And, since the HTML
specification does not support nested <form> tags, this means I cannot add
another HTML <form> tag to perform a non-ASP.NET form post.

Ideally, it seems like I should be able to write a normal ASP.NET button
event handler, and have the handler emulate a form post (and redirection).

Unfortunately, I cannot get this to work. This would be a cool trick as
searching the Web found lots of people with the same problem but no
solutions.

Thanks!

Look for HTTP Post
http://www.dotnet247.com/247reference/msgs/19/95431.aspx
http://www.west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm
 
S

Scott Roberts

I want to do a FORM POST to a non-ASP.NET page on another site. I can do
this with a regular HTML <form> tag. However, this doesn't work well with
ASP.NET.

Sure it does, it's just not as obvious as one would hope. To post a ASP.NET
form to a different URL, use the PostBackUrl property on the submit button.
 
J

Jonathan Wood

That only works when posting to ASP.NET pages on the same server. As
described, I want to post to a non-ASP.NET page on another server.
PostBackUrl is of no value here.
 
A

Alexey Smirnov

Alexey,







Thanks, but while this apparently seems like an easy problem at first
glance, neither of these solutions will forward to the page being posted to
per my description.

--
Jonathan Wood
SoftCircuits Programminghttp://www.softcircuits.com- Hide quoted text -

- Show quoted text -

you can also do a simple redirect to the target page adding all fields
in the url

e.g. http://www.google.com/search?hl=en&q=asp

stays for

<input type=hidden name=hl value="en">
<input type=text name=q value="asp">

or try to use a client-side javascript to change the ASP.NET form
action attribute
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top