469,909 Members | 1,884 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

How to Post a Form

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.
Nov 19 '05 #1
17 1483
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...c-d3b8b4f29eaf

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.


Nov 19 '05 #2
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" wrote:
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...c-d3b8b4f29eaf

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.


Nov 19 '05 #3
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? :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:
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...d=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.


Nov 19 '05 #4
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" wrote:
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? :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:
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...d=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.


Nov 19 '05 #5
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" wrote:
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? :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:
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...d=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.


Nov 19 '05 #6
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" wrote:
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? :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:
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...d=483742fd-01a
2-4975-b76c-d3b8b4f29eaf

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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.


Nov 19 '05 #7
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.

"Justin" wrote:
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.

Nov 19 '05 #8
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.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
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.

Nov 19 '05 #9
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...

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:
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? :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:

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...uid=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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
> 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.
>


Nov 19 '05 #10
What do you think about using the webrequest and webresponse classes?

"Steve C. Orr [MVP, MCSD]" wrote:
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.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
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.


Nov 19 '05 #11
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
el********@hotmail.com
-----Original Message-----
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.
.

Nov 19 '05 #12
That's a good approach too.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
What do you think about using the webrequest and webresponse classes?

"Steve C. Orr [MVP, MCSD]" wrote:
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.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
> 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.


Nov 19 '05 #13
"Elton Wang" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
In ASP.NET 1.1/1.0, action = otherUrl doesn't work.


?????
Nov 19 '05 #14
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

-----Original Message-----
"Elton Wang" <an*******@discussions.microsoft.com> wrote in messagenews:0d****************************@phx.gbl...
In ASP.NET 1.1/1.0, action = otherUrl doesn't work.


?????
.

Nov 19 '05 #15
"Elton Wang" <an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
Hope it's clear.


So remove the "runat=server" part of the form tag...
Nov 19 '05 #16
Hi Justin..

check this link...

http://www.paypaldev.org/topic.asp?TOPIC_ID=6289
"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:09**********************************@microsof t.com...
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" wrote:
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? :)

-Brock
DevelopMentor
http://staff.develop.com/ballen
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" wrote:

> 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...d=483742fd-01a
> 2-4975-b76c-d3b8b4f29eaf
>
> But if you need to post to a completely different application, then
> it's not different than before.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>> 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.
>>


Nov 19 '05 #17
Yes you can do it, But don't put any server control inside
the form tags.

-----Original Message-----
"Elton Wang" <an*******@discussions.microsoft.com> wrote in messagenews:07****************************@phx.gbl...
Hope it's clear.


So remove the "runat=server" part of the form tag...
.

Nov 19 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Thomas Scheiderich | last post: by
1 post views Thread by Manuel | last post: by
10 posts views Thread by glenn | last post: by
24 posts views Thread by moriman | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.