Post a form (server side) and submit to external url

G

Gert

Hi,

I have a form (server side) because of the filling of variables through the
application. But now I need to post it to an url on submit.
My .HTML form looks like this, but how to translate it to asp.net vb code?

!--<FORM ACTION="/test/test.php" METHOD=POST>-->
<form action="https://multipay.net/transaction/mpmain.php" method="post">

....

<INPUT TYPE=SUBMIT VALUE="SUBMIT ORDER">

I saw messages about doing a client side javascript as action for onsubmit.
This is not clear to be and seems not the right way.



Thanks,

Gert
 
M

Mr Newbie

You cant simply post a form to an ASP.NET webserver. You need to create a
webform and GET the webform, flll in the fields and then postback the form
to the server.
 
M

Mr Newbie

Thats only because I have been watching Star Trek Voyager for so long, I
think I have developed the biological equivelent of a 'Universal
Translator', and this helps be extrapolate from garbage and bring order to
chaos . . . . ( Sometimes ! )

Live Long And Prosper - \\//

;-D
 
K

Kevin Spencer

Actually, you *can* simply post a form from a server-side app to a web URL.
I have built a set of classes for doing just this.

The trick is to create an HTTP POST Request with the form data Url-encoded
into it as it would be if it were coming from a browser (remember that HTTP
is stateless - requesting a form from a web server in no way tells the web
server to expect a form post coming from the client).

The set of classes I've created have been working quite well from within a
service we have on our system which checks data on several public weather
information web sites, to see how long it takes for weather data we provide
to the NWS takes to get to these web sites.

In fact, these classes also include the ability to fetch an HTML form from a
given URL, and parse it into a class (called "HtmlFormData"). The class can
then be used to programmatically "fill out" the form, by changing the
various value properties of the different class members (which represent
HTML form fields), and then post it to the URL of its "action" property. The
HtmlFormData class can be used to add, remove, or modify the contents of an
HTML form, or to build one from scratch, if desired. The ToString() method
of the class returns the HtmlFormData class as HTML (in the form of an HTML
form).

It is used in conjunction with several networking classes, most notably the
HttpClient class that we created, and is part of the same assembly, and a
set of HTML form-parsing Regular Expressions that are in another class in
the same assembly.

I am in the process of creating a commercially-available component class
library that includes this, as well as over 60 classes, structs, interfaces,
enumerations, and delegates, which are useful in a variety of situations as
well. If you'd like to help with the beta testing, email me and I'll send
you a copy. Just promise to give me your feedback on it.

Oh yes. One other thing. It's all .Net 2.0.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
M

Mr Newbie

Good to hear that you might be making some money for your efforts, thats
allways a bonus!

I take your point regarding the Url-encoded POST, but the OP was trying to
do this with a browser I think ?!? What do you do about Viewstate ? or is
this just left empty ?

As far as BETA testing your classes, I would be happy to help, but Im snowed
under at the moment and I dont think I could do your testing justice . But I
wish you well with it, and if things slow down a little, I may take you up
on the offer as it sounds really interesting.
 
P

Patrick.O.Ige

Great idea Kevin.
Will be intouch
Patrick

Kevin Spencer said:
Actually, you *can* simply post a form from a server-side app to a web URL.
I have built a set of classes for doing just this.

The trick is to create an HTTP POST Request with the form data Url-encoded
into it as it would be if it were coming from a browser (remember that HTTP
is stateless - requesting a form from a web server in no way tells the web
server to expect a form post coming from the client).

The set of classes I've created have been working quite well from within a
service we have on our system which checks data on several public weather
information web sites, to see how long it takes for weather data we provide
to the NWS takes to get to these web sites.

In fact, these classes also include the ability to fetch an HTML form from a
given URL, and parse it into a class (called "HtmlFormData"). The class can
then be used to programmatically "fill out" the form, by changing the
various value properties of the different class members (which represent
HTML form fields), and then post it to the URL of its "action" property. The
HtmlFormData class can be used to add, remove, or modify the contents of an
HTML form, or to build one from scratch, if desired. The ToString() method
of the class returns the HtmlFormData class as HTML (in the form of an HTML
form).

It is used in conjunction with several networking classes, most notably the
HttpClient class that we created, and is part of the same assembly, and a
set of HTML form-parsing Regular Expressions that are in another class in
the same assembly.

I am in the process of creating a commercially-available component class
library that includes this, as well as over 60 classes, structs, interfaces,
enumerations, and delegates, which are useful in a variety of situations as
well. If you'd like to help with the beta testing, email me and I'll send
you a copy. Just promise to give me your feedback on it.

Oh yes. One other thing. It's all .Net 2.0.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
A watched clock never boils.
 

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

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top