473,473 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

controling POST action in ASP.NET 1.1

How do I specify that I want the data in a form to post to a DIFFERENT
document?

I've come across the Button.PostBackUrl property, but it is available in
ASP.NET v. 2.0 only, and I'm using v.1.1.

This seems like such a COMMON thing, I can't imagine that there isn't a
SIMPLE way to do this....

Thanks for your help,
----G

Nov 17 '06 #1
9 1434
The short answer is, you don't. This is the standard post mechanism in
ASP.NET.

Having said that, if you remove the runat=server attribute of the built-in
form in your page, then you can use the form as a traditional HTML form, by
adding the Action attribute and set its value to the page you wish to post
to.

In addition, you can always use Server.Transfer() to redirect to another
page and pass data values along with the transfer.
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:11**********************************@microsof t.com...
How do I specify that I want the data in a form to post to a DIFFERENT
document?

I've come across the Button.PostBackUrl property, but it is available in
ASP.NET v. 2.0 only, and I'm using v.1.1.

This seems like such a COMMON thing, I can't imagine that there isn't a
SIMPLE way to do this....

Thanks for your help,
----G

Nov 18 '06 #2
ASP.NET 1.1 developers can achieve the functionality of cross page posting
by using the Server.Transfer Method, which preserves the HttpContext of
the current page before transferring to the other page.

Since HttpContext is preserved you can access the
source page's items collection in the target page.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:11**********************************@microsof t.com...
How do I specify that I want the data in a form to post to a DIFFERENT
document?

I've come across the Button.PostBackUrl property, but it is available in
ASP.NET v. 2.0 only, and I'm using v.1.1.

This seems like such a COMMON thing, I can't imagine that there isn't a
SIMPLE way to do this....

Thanks for your help,
----G

Nov 18 '06 #3
Am I correct in thinking that Server.Transfer does not actually change the
browser location to the target? My understanding (and I could be wrong about
this) is that it loads the target document but in the source location,
keeping the source location URL in the browser.

This is a problem for me for a variety of reasons. For example, history
control, e.g.:
* people login at login.aspx
* once logged in, I want to transfer them to account.aspx

Lets say they click on a link to some other page, and then want to go back
to their account page so they click on the "back" button in their
browser..... if, after login, CONTROL is sent to the account.aspx page but
the browser location is not, then the "back" button will bring them all the
way back to the login screen.

That's just one example... there are actually several reasons that I want to
be able to control the actual browser location URL after the form is
submitted.

So are you telling me that there is NO way to directly control the ACTION
attribute of a form that is created as a server control? Why on earth would
they want to be so restrictive about that?

----G
"Juan T. Llibre" wrote:
ASP.NET 1.1 developers can achieve the functionality of cross page posting
by using the Server.Transfer Method, which preserves the HttpContext of
the current page before transferring to the other page.

Since HttpContext is preserved you can access the
source page's items collection in the target page.
Nov 18 '06 #4
I don't mean to vent, but.... what the H? How exactly did the creators of
ASP.NET decide that nobody should ever post data across documents? Especially
when it's something that is SO easy and SO common in standard HTML forms?

OK, sorry. Moving on, now, to your other suggestions:

1) I can't remove the runat="Server" from the Form element (That was the
first thing I tried), because then it won't let me use any of the server
controls (asp:Label, asp:Button, etc) inside the form, and it won't let me
specify any server-side event handling for elements in the form. I get a
compile error saying the ONLY way to use server-side form elements is if the
form itself has the runat="Server" attribute. Apparently, it's all-or-nothing.

2) I believe that Server.Transfer processes the target page without changing
the actual URL. (Although please correct me if I'm wrong about this.) When
someone completes the form, I actually need the data (and the user) to be
transferred to another document, with another URL. There are some cases, for
example, where I even need to post the data to a new document opened in a new
window. I don't believe Server.Transfer can do this.... (although, again, if
I'm wrong, please let me know!)

Thanks for your help!
-----G
"Scott M." wrote:
The short answer is, you don't. This is the standard post mechanism in
ASP.NET.

Having said that, if you remove the runat=server attribute of the built-in
form in your page, then you can use the form as a traditional HTML form, by
adding the Action attribute and set its value to the page you wish to post
to.

In addition, you can always use Server.Transfer() to redirect to another
page and pass data values along with the transfer.
Nov 18 '06 #5
I believe that the browser does get redirected to the new page.
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:DF**********************************@microsof t.com...
Am I correct in thinking that Server.Transfer does not actually change the
browser location to the target? My understanding (and I could be wrong
about
this) is that it loads the target document but in the source location,
keeping the source location URL in the browser.

This is a problem for me for a variety of reasons. For example, history
control, e.g.:
* people login at login.aspx
* once logged in, I want to transfer them to account.aspx

Lets say they click on a link to some other page, and then want to go back
to their account page so they click on the "back" button in their
browser..... if, after login, CONTROL is sent to the account.aspx page but
the browser location is not, then the "back" button will bring them all
the
way back to the login screen.

That's just one example... there are actually several reasons that I want
to
be able to control the actual browser location URL after the form is
submitted.

So are you telling me that there is NO way to directly control the ACTION
attribute of a form that is created as a server control? Why on earth
would
they want to be so restrictive about that?

----G
"Juan T. Llibre" wrote:
>ASP.NET 1.1 developers can achieve the functionality of cross page
posting
by using the Server.Transfer Method, which preserves the HttpContext of
the current page before transferring to the other page.

Since HttpContext is preserved you can access the
source page's items collection in the target page.

Nov 18 '06 #6

"Greg Stevens" <Gr***********@gmail.comwrote in message
news:CF**********************************@microsof t.com...
>I don't mean to vent, but.... what the H? How exactly did the creators of
ASP.NET decide that nobody should ever post data across documents?
Especially
when it's something that is SO easy and SO common in standard HTML forms?
It just sounds like you are new to ASP.NET. It turns out that it is far
easier to work with a self-posting page than posting to a different page.
OK, sorry. Moving on, now, to your other suggestions:
:)
1) I can't remove the runat="Server" from the Form element (That was the
first thing I tried), because then it won't let me use any of the server
controls (asp:Label, asp:Button, etc) inside the form, and it won't let me
specify any server-side event handling for elements in the form. I get a
compile error saying the ONLY way to use server-side form elements is if
the
form itself has the runat="Server" attribute. Apparently, it's
all-or-nothing.
True, which is why my first response to you was "you don't".
2) I believe that Server.Transfer processes the target page without
changing
the actual URL. (Although please correct me if I'm wrong about this.)
When
someone completes the form, I actually need the data (and the user) to be
transferred to another document, with another URL. There are some cases,
for
example, where I even need to post the data to a new document opened in a
new
window. I don't believe Server.Transfer can do this.... (although, again,
if
I'm wrong, please let me know!)
No, I believe Server.Transfer does redirect you.
>
Thanks for your help!
-----G
"Scott M." wrote:
>The short answer is, you don't. This is the standard post mechanism in
ASP.NET.

Having said that, if you remove the runat=server attribute of the
built-in
form in your page, then you can use the form as a traditional HTML form,
by
adding the Action attribute and set its value to the page you wish to
post
to.

In addition, you can always use Server.Transfer() to redirect to another
page and pass data values along with the transfer.

Nov 18 '06 #7
OK, thank you for your responses. And you're right, of course: I am new to
ASP.NET.... and it sounds like I should probably just welcome the new ASP.NET
overlords; and if you are right, I'll be happier once I do... ;-)

-----G

"Scott M." wrote:
>
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:CF**********************************@microsof t.com...
I don't mean to vent, but.... what the H? How exactly did the creators of
ASP.NET decide that nobody should ever post data across documents?
Especially
when it's something that is SO easy and SO common in standard HTML forms?

It just sounds like you are new to ASP.NET. It turns out that it is far
easier to work with a self-posting page than posting to a different page.
OK, sorry. Moving on, now, to your other suggestions:

:)
1) I can't remove the runat="Server" from the Form element (That was the
first thing I tried), because then it won't let me use any of the server
controls (asp:Label, asp:Button, etc) inside the form, and it won't let me
specify any server-side event handling for elements in the form. I get a
compile error saying the ONLY way to use server-side form elements is if
the
form itself has the runat="Server" attribute. Apparently, it's
all-or-nothing.

True, which is why my first response to you was "you don't".
2) I believe that Server.Transfer processes the target page without
changing
the actual URL. (Although please correct me if I'm wrong about this.)
When
someone completes the form, I actually need the data (and the user) to be
transferred to another document, with another URL. There are some cases,
for
example, where I even need to post the data to a new document opened in a
new
window. I don't believe Server.Transfer can do this.... (although, again,
if
I'm wrong, please let me know!)

No, I believe Server.Transfer does redirect you.

Thanks for your help!
-----G
"Scott M." wrote:
The short answer is, you don't. This is the standard post mechanism in
ASP.NET.

Having said that, if you remove the runat=server attribute of the
built-in
form in your page, then you can use the form as a traditional HTML form,
by
adding the Action attribute and set its value to the page you wish to
post
to.

In addition, you can always use Server.Transfer() to redirect to another
page and pass data values along with the transfer.


Nov 18 '06 #8
I do think you'll be happier if you keep an open mind and try not to
approach .NET with a "this is how I always did it before" mindset.

In addition, this link may help you out:

http://www.developer.com/net/asp/article.php/3299641

Good luck!
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:92**********************************@microsof t.com...
OK, thank you for your responses. And you're right, of course: I am new
to
ASP.NET.... and it sounds like I should probably just welcome the new
ASP.NET
overlords; and if you are right, I'll be happier once I do... ;-)

-----G

"Scott M." wrote:
>>
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:CF**********************************@microso ft.com...
>I don't mean to vent, but.... what the H? How exactly did the creators
of
ASP.NET decide that nobody should ever post data across documents?
Especially
when it's something that is SO easy and SO common in standard HTML
forms?

It just sounds like you are new to ASP.NET. It turns out that it is far
easier to work with a self-posting page than posting to a different page.
OK, sorry. Moving on, now, to your other suggestions:

:)
1) I can't remove the runat="Server" from the Form element (That was
the
first thing I tried), because then it won't let me use any of the
server
controls (asp:Label, asp:Button, etc) inside the form, and it won't let
me
specify any server-side event handling for elements in the form. I get
a
compile error saying the ONLY way to use server-side form elements is
if
the
form itself has the runat="Server" attribute. Apparently, it's
all-or-nothing.

True, which is why my first response to you was "you don't".
2) I believe that Server.Transfer processes the target page without
changing
the actual URL. (Although please correct me if I'm wrong about this.)
When
someone completes the form, I actually need the data (and the user) to
be
transferred to another document, with another URL. There are some
cases,
for
example, where I even need to post the data to a new document opened in
a
new
window. I don't believe Server.Transfer can do this.... (although,
again,
if
I'm wrong, please let me know!)

No, I believe Server.Transfer does redirect you.
>
Thanks for your help!
-----G
"Scott M." wrote:

The short answer is, you don't. This is the standard post mechanism
in
ASP.NET.

Having said that, if you remove the runat=server attribute of the
built-in
form in your page, then you can use the form as a traditional HTML
form,
by
adding the Action attribute and set its value to the page you wish to
post
to.

In addition, you can always use Server.Transfer() to redirect to
another
page and pass data values along with the transfer.



Nov 18 '06 #9
Just FYI, the article that YOU linked me to on the difference between
Server.Transfer and Response.Redirect says this:

"Secondly, Server.Transfer maintains the original URL in the browser. "

So, the browser does NOT get redirected to the new page.

Just thought you should know.

---G

"Scott M." wrote:
I believe that the browser does get redirected to the new page.
"Greg Stevens" <Gr***********@gmail.comwrote in message
news:DF**********************************@microsof t.com...
Am I correct in thinking that Server.Transfer does not actually change the
browser location to the target? My understanding (and I could be wrong
about
this) is that it loads the target document but in the source location,
keeping the source location URL in the browser.

This is a problem for me for a variety of reasons. For example, history
control, e.g.:
* people login at login.aspx
* once logged in, I want to transfer them to account.aspx

Lets say they click on a link to some other page, and then want to go back
to their account page so they click on the "back" button in their
browser..... if, after login, CONTROL is sent to the account.aspx page but
the browser location is not, then the "back" button will bring them all
the
way back to the login screen.

That's just one example... there are actually several reasons that I want
to
be able to control the actual browser location URL after the form is
submitted.

So are you telling me that there is NO way to directly control the ACTION
attribute of a form that is created as a server control? Why on earth
would
they want to be so restrictive about that?

----G
"Juan T. Llibre" wrote:
ASP.NET 1.1 developers can achieve the functionality of cross page
posting
by using the Server.Transfer Method, which preserves the HttpContext of
the current page before transferring to the other page.

Since HttpContext is preserved you can access the
source page's items collection in the target page.


Nov 19 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: q2005 | last post by:
Hi, all Is that possible I can do window.open("http://xserver1/app/typ/test/tesServer.php?aaa=111&bbb=222&ccc= 333","","") to simulate a POST ACTION with a form rather than a GET ACTION? Jack
1
by: Mohammed Abdel-Razzak | last post by:
Dear sirs I want you to give me link to some articles talking about controling the computer hardware from C#. But what I most need now: How can I open the CDRom from my C# application??? ...
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 ...
5
by: David C. Allen | last post by:
I have a vb.net app that is controling excel 2000 thru the com interop interface. I have referenced the excel 9.0 library and have cut down the code in the problem subroutine to this: Dim...
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...
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
3
by: austinra | last post by:
I am trying to control my data control box with a combo box. I want the combo box to change the data control's record source. i have tryied to write an if then statement if cbomoviecategory =...
4
by: Bosconian | last post by:
I have created a form tool page that consists of several dropdowns which allows a user to drill down and select a desired document for viewing in an external window. I need to post the form data to...
6
by: rpcchandu | last post by:
Hi Coders, I have to redirect from my server to the different server page by simulating the POST method submit from the Controller file, I tried using post_via_redirect, but could not succeed......
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.