473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1619
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: TG | last post by:
Dear PHP Group, I have two forms that are used to collect user information. The first one takes user inputted values such as fullname, city, address etc. I want these values to display in the...
3
by: sammmista | last post by:
hello experts, Plz dont treat this as another newbie query , i did my homework but still getting nowhere :( :( :( Trying to learn PHP on Fedora core 1 (PHP 4.3,MySQL,HTTPD).Unable to post data...
15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
1
by: Manuel | last post by:
I have to log into a website and retrieve some information. The problem is that the post isn't "normal". I'm used to passing post values in the form of: Variable1=Value1&Variable2=Value2 etc. I...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
8
by: Gert | last post by:
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...
24
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button...
2
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata ...
10
by: Peter Michaux | last post by:
Hi, All Ajax libraries I've read use encodeURIComponent() on the name- value pairs extracted from forms before POST ing the result to the server with and xmlhttprequest. I can understand why...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.