473,511 Members | 16,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.Transfer() and POST data

I am creating a form on the server that I want to POST to a URL that's being
called with Server.Transfer(). What's the simplest way to do that?

A little background: I'm programming buttons that link to PayPal's shopping
cart. PayPal wants an HTML form with data about the product selected
(including price), and they provide sample HTML to create a hidden form to
transmit the data when the 'Add to cart' button is clicked.

It would be absurdly easy for a hacker to change the price from $100 to $1
or defraud the site in other ways. So, rather than linking to PayPal, I want
to
link the 'Add to cart' button to a page that runs on my server and never
downloads to the user's browser.

The 'Add to cart' button passes just the item number to a server page, which
calls a C# method in its Form_Load event. The method will programmatically
create the form data that will be set as POST data. The method then calls
Server.Transfer() to pass control to PayPal's shopping cart.

So, what's the simplest way to assemble the data? I'd like to create it as a
NameValueCollection, and then call something which sets it as POST data
for the Request that's passed when I call Server.Transfer(). Is that
possible?
Are there examples of how to do this? Thanks.

David Veeneman
Foresight Systems
Nov 7 '06 #1
3 3967
David Veeneman wrote:
I am creating a form on the server that I want to POST to a URL that's being
called with Server.Transfer(). What's the simplest way to do that?

A little background: I'm programming buttons that link to PayPal's shopping
cart. PayPal wants an HTML form with data about the product selected
(including price), and they provide sample HTML to create a hidden form to
transmit the data when the 'Add to cart' button is clicked.

It would be absurdly easy for a hacker to change the price from $100 to $1
or defraud the site in other ways. So, rather than linking to PayPal, I want
to
link the 'Add to cart' button to a page that runs on my server and never
downloads to the user's browser.

The 'Add to cart' button passes just the item number to a server page, which
calls a C# method in its Form_Load event. The method will programmatically
create the form data that will be set as POST data. The method then calls
Server.Transfer() to pass control to PayPal's shopping cart.

So, what's the simplest way to assemble the data? I'd like to create it as a
NameValueCollection, and then call something which sets it as POST data
for the Request that's passed when I call Server.Transfer(). Is that
possible?
Are there examples of how to do this? Thanks.

David Veeneman
Foresight Systems
You can't use Server.Transfer to execute a page on a different server.
Server.Transfer does not send a request.

You can use the WebRequest or WebClient classes to make the request.
Nov 7 '06 #2
Thanks. I can see how to use those classes to send values to a PayPal page,
but how do I go about loading PayPal's response as the current web page?
Most of the methods appear to return the response as a byte array.
Nov 7 '06 #3
David Veeneman wrote:
Thanks. I can see how to use those classes to send values to a PayPal page,
but how do I go about loading PayPal's response as the current web page?
Most of the methods appear to return the response as a byte array.
Use Response.BinaryWrite to send the response in binary format.
Nov 8 '06 #4

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

Similar topics

6
2221
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web...
4
1320
by: Mathew | last post by:
Hello: I have an app that has been running for several months, but after installing SP4 on the Win2k server, it would no longer run. First I had a TemplateControl parser exception when the...
3
2120
by: Manuel Lopez | last post by:
Hello, We have two applications that will reside on the same webserver. We want to be able to post from pages in App1 to to pages in App2. We need to pass sensible data, so we cannot use...
9
647
by: Steve Buster | last post by:
All right, I have read every forum, newsgroup etc about this issue and no one seems to know how to fix it. I am getting a "Server Application Unavailable" exception running my .NET 1.1...
4
2854
by: Piotr Strycharz | last post by:
Hi all I do have a problem. How can I transfer user to another server using POST. The problem is that Server.Transfer (preserves form data) works just in current server. Response.Redirect -...
11
5994
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it...
2
2790
by: Oleg | last post by:
I'm trying to post from Page1 to Page2. Page1: controlData.Value = "Data value";//controlData is HtmlInputHidden // Request.Form would return: "Data" Server.Redirect("Page2.aspx",true); Page2:...
23
6766
by: barryfz | last post by:
I need to be able to move from one web app on my server to another on the same server and preserve the session state. I have played with server.transfer but I get an error saying I can't do this....
4
3487
by: David Veeneman | last post by:
I want to programmatically create some POST data on a web server, then pass that data to another web page that the server calls, using Server.Transfer(). What's the best way to do that? I'm...
0
7242
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
7355
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,...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
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...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
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
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
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.