How to Post a Form

B

Brock Allen

Forms in ASP.NET postback to the same page that rendered them so you can
take advantage of the object model. When you postback all of the server side
controls are recreated and repopulated with the values that are posted back
to the page. This provides for a much higher level programming model, and
therefore makes you as the developer more productive.

Now, if you really want to post to a second page, you can. But then you're
back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then it's
not different than before.
 
G

Guest

I noticed that the Action and Method options are still available for use with
ASP.NET forms. What will happen to the post back data if I set the action and
method options.

Brock Allen said:
Forms in ASP.NET postback to the same page that rendered them so you can
take advantage of the object model. When you postback all of the server side
controls are recreated and repopulated with the values that are posted back
to the page. This provides for a much higher level programming model, and
therefore makes you as the developer more productive.

Now, if you really want to post to a second page, you can. But then you're
back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then it's
not different than before.




How do I post a form to a specified url using an ASP.NET with a code
behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 
B

Brock Allen

It will be posted based upon how you set these two options. To whatever URL
and via whichever method you specify.

Are you having a problem? What exactly are you trying to do? Or are you just
figuring things out? :)




I noticed that the Action and Method options are still available for
use with ASP.NET forms. What will happen to the post back data if I
set the action and method options.

Brock Allen said:
Forms in ASP.NET postback to the same page that rendered them so you
can take advantage of the object model. When you postback all of the
server side controls are recreated and repopulated with the values
that are posted back to the page. This provides for a much higher
level programming model, and therefore makes you as the developer
more productive.

Now, if you really want to post to a second page, you can. But then
you're back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without
sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then
it's not different than before.

How do I post a form to a specified url using an ASP.NET with a
code behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 
G

Guest

I am creating an ecommerce site with the ASP.NET commerce kit, I am trying to
figure out the best way to post data to the merchant processor.

I may have to use the webrequest and webresponse classes.

Have you used the Commerce Kit?

Thanks, Justin.

Brock Allen said:
It will be posted based upon how you set these two options. To whatever URL
and via whichever method you specify.

Are you having a problem? What exactly are you trying to do? Or are you just
figuring things out? :)




I noticed that the Action and Method options are still available for
use with ASP.NET forms. What will happen to the post back data if I
set the action and method options.

Brock Allen said:
Forms in ASP.NET postback to the same page that rendered them so you
can take advantage of the object model. When you postback all of the
server side controls are recreated and repopulated with the values
that are posted back to the page. This provides for a much higher
level programming model, and therefore makes you as the developer
more productive.

Now, if you really want to post to a second page, you can. But then
you're back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without
sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then
it's not different than before.


How do I post a form to a specified url using an ASP.NET with a
code behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 
G

Guest

I am creating an ecommerce site with the ASP.NET commerce kit, I am trying to
figure out the best way to post data to the merchant processor.

I may have to use the webrequest and webresponse classes.

Have you used the Commerce Kit?

Thanks, Justin.

Brock Allen said:
It will be posted based upon how you set these two options. To whatever URL
and via whichever method you specify.

Are you having a problem? What exactly are you trying to do? Or are you just
figuring things out? :)




I noticed that the Action and Method options are still available for
use with ASP.NET forms. What will happen to the post back data if I
set the action and method options.

Brock Allen said:
Forms in ASP.NET postback to the same page that rendered them so you
can take advantage of the object model. When you postback all of the
server side controls are recreated and repopulated with the values
that are posted back to the page. This provides for a much higher
level programming model, and therefore makes you as the developer
more productive.

Now, if you really want to post to a second page, you can. But then
you're back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without
sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then
it's not different than before.


How do I post a form to a specified url using an ASP.NET with a
code behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 
G

Guest

I am creating an ecommerce site with the ASP.NET commerce kit, I am trying to
figure out the best way to post data to the merchant processor.

I may have to use the webrequest and webresponse classes.

Have you used the Commerce Kit?

Thanks, Justin.
 
G

Guest

I am creating an ecommerce site with the ASP.NET commerce kit, I am trying to
figure out the best way to post data to the merchant processor.

I may have to use the webrequest and webresponse classes.

Have you used the Commerce Kit?

Thanks, Justin.

Brock Allen said:
It will be posted based upon how you set these two options. To whatever URL
and via whichever method you specify.

Are you having a problem? What exactly are you trying to do? Or are you just
figuring things out? :)




I noticed that the Action and Method options are still available for
use with ASP.NET forms. What will happen to the post back data if I
set the action and method options.

Brock Allen said:
Forms in ASP.NET postback to the same page that rendered them so you
can take advantage of the object model. When you postback all of the
server side controls are recreated and repopulated with the values
that are posted back to the page. This provides for a much higher
level programming model, and therefore makes you as the developer
more productive.

Now, if you really want to post to a second page, you can. But then
you're back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without
sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then
it's not different than before.


How do I post a form to a specified url using an ASP.NET with a
code behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 
S

Steve C. Orr [MVP, MCSD]

Here are some options:
1) Output an old fashioned non-server form to the client (without the runat=
'server' attribute) Set the action attribute like you would have in
ASP.OLD, and use javascript to submit the form.
2) use client side script to change your ASP.NET form action attribute
3) use this webform control: http://www.wilsondotnet.com/Controls/

Note: In ASP.NET 2.0 you will be able to more easily post to another page.
 
B

Brock Allen

Well, if you want the user with the browser to do the post, then what you've
suggested so far sounds ok/fine. But if you want to hide the fact that you
need to do a post in order to do some backend processing (CC processing,
for example) then yeah, you're looking at HttpWebRequest or... do they have
a web service? That'd be much easier on you...




I am creating an ecommerce site with the ASP.NET commerce kit, I am
trying to figure out the best way to post data to the merchant
processor.

I may have to use the webrequest and webresponse classes.

Have you used the Commerce Kit?

Thanks, Justin.

Brock Allen said:
It will be posted based upon how you set these two options. To
whatever URL and via whichever method you specify.

Are you having a problem? What exactly are you trying to do? Or are
you just figuring things out? :)

I noticed that the Action and Method options are still available for
use with ASP.NET forms. What will happen to the post back data if I
set the action and method options.

:

Forms in ASP.NET postback to the same page that rendered them so
you can take advantage of the object model. When you postback all
of the server side controls are recreated and repopulated with the
values that are posted back to the page. This provides for a much
higher level programming model, and therefore makes you as the
developer more productive.

Now, if you really want to post to a second page, you can. But then
you're back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback
without sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-0
1a 2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then
it's not different than before.


How do I post a form to a specified url using an ASP.NET with a
code behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 
E

Elton Wang

Hi Justin,

In ASP.NET 1.1/1.0, action = otherUrl doesn't work.

You might use other way to shift to other url, for
example, you can use Response.Redirect(Url). But it
doesn't post original form data with it. So you may need
to use SessionState, ApplicationState, ViewState, Cookies
to shared data.

HTH

Elton Wang
(e-mail address removed)
 
E

Elton Wang

Normally in a aspx page, e.g. default.aspx, it shows

<form id="Form1" method="post" runat="server">

After it renders to client-side, the html shows <form
name="Form1" method="post" action="default.aspx"
id="Form1">

Event you can change it to

<form id="Form1" method="post" runat="server"
action="process.aspx">

After rendering, it shows same thing

<form name="Form1" method="post" action="default.aspx"
id="Form1">

rather than

<form name="Form1" method="post" action="process.aspx"
id="Form1">

Hope it's clear.

Elton Wang
 
M

Michael

Hi Justin..

check this link...

http://www.paypaldev.org/topic.asp?TOPIC_ID=6289


Justin said:
I am creating an ecommerce site with the ASP.NET commerce kit, I am trying to
figure out the best way to post data to the merchant processor.

I may have to use the webrequest and webresponse classes.

Have you used the Commerce Kit?

Thanks, Justin.

Brock Allen said:
It will be posted based upon how you set these two options. To whatever URL
and via whichever method you specify.

Are you having a problem? What exactly are you trying to do? Or are you just
figuring things out? :)




I noticed that the Action and Method options are still available for
use with ASP.NET forms. What will happen to the post back data if I
set the action and method options.

:

Forms in ASP.NET postback to the same page that rendered them so you
can take advantage of the object model. When you postback all of the
server side controls are recreated and repopulated with the values
that are posted back to the page. This provides for a much higher
level programming model, and therefore makes you as the developer
more productive.

Now, if you really want to post to a second page, you can. But then
you're back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without
sacrificing

the ASP.NET object model. Some notes on that are here:

http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

But if you need to post to a completely different application, then
it's not different than before.


How do I post a form to a specified url using an ASP.NET with a
code behind? With traditional ASP I used to be able to simply use:
action="https://www.domain.com/process.asp"

Thanks, Justin.
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top