473,811 Members | 4,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating POST data for Server.Transfer ()?

I want to programmaticall y 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 programming some buttons that link to PayPal's shopping cart. The
shopping cart needs a bunch of data about the item being added, including
price. PayPal's sample markup puts the data in a hidden form, which the
button submits.

I'm concerned about the lack of security in that approach, so I want to have
the button invoke a method on the server that will assemble the POST data
that PayPal needs, and then redirect to PayPal. Right now I have a 'button
dispatch' page, which contains the data assembly and redirect
(Server.Transfe r()) code in its Page_Load event.

What I can't figure out is how to get the POST data into the Request the
page will submit when it redirects to PayPal. What's the simplest way to do
this? Are there any examples? Thanks much.

David Veeneman
Foresight Systems

Nov 7 '06 #1
4 3493
My bad. Server.Transfer won't call an external page or make a request.

I'm still stuck with my basic problem of needing to create POST data
programmaticall y and sending it to PayPall, and ending up on the PayPal page
I sent the data to. Any ideas?
Nov 7 '06 #2
"David Veeneman" <dc*@nospam.com wrote in message
news:O4******** ******@TK2MSFTN GP02.phx.gbl...
My bad. Server.Transfer won't call an external page or make a request.

I'm still stuck with my basic problem of needing to create POST data
programmaticall y and sending it to PayPall, and ending up on the PayPal
page I sent the data to. Any ideas?
It's not too hard - the POST data is just name-value pairs separated by
ampersands - just like on the query string. Oh, and you have to set the
content-type to the correct value as well.

I have an HttpPostRequest class that I threw together that neatly wraps up
form-style post requests. I'm not at the same location as that code right
now, but if no one else has posted some code by the end of the day, I'll see
if I can track down that class & make it available.

-cd
Nov 7 '06 #3
Carl Daniel [VC++ MVP] wrote:
"David Veeneman" <dc*@nospam.com wrote in message
news:O4******** ******@TK2MSFTN GP02.phx.gbl...
>My bad. Server.Transfer won't call an external page or make a
request. I'm still stuck with my basic problem of needing to create POST
data
programmatical ly and sending it to PayPall, and ending up on the
PayPal page I sent the data to. Any ideas?

It's not too hard - the POST data is just name-value pairs separated
by ampersands - just like on the query string. Oh, and you have to
set the content-type to the correct value as well.

I have an HttpPostRequest class that I threw together that neatly
wraps up form-style post requests. I'm not at the same location as
that code right now, but if no one else has posted some code by the
end of the day, I'll see if I can track down that class & make it
available.
I was about to post the code and then I realized that I think you're asking
for something else. If I'm reading you right, you're writing code that's in
the code-behind (beside, inline, whatever) for an ASP.NET page and you need
to do a POST to PayPal and have the user's browser end up viewing the page
that PayPal returns. Is that right?

If that's what you're after, then the way to do it is to enlist the help of
the user's browser. Have your ASP.NET page return a page with a pre-filled
<form(all elements can simply be <input type="hidden">) and use
client-side JScript to post that form in the client-side page load event.
That way, the user's browser actually makes the post & displayes the results
just like the user expects.

-cd
Nov 8 '06 #4
David Veeneman wrote:
I want to programmaticall y 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 programming some buttons that link to PayPal's shopping cart. The
shopping cart needs a bunch of data about the item being added, including
price. PayPal's sample markup puts the data in a hidden form, which the
button submits.

I'm concerned about the lack of security in that approach, so I want to have
the button invoke a method on the server that will assemble the POST data
that PayPal needs, and then redirect to PayPal. Right now I have a 'button
dispatch' page, which contains the data assembly and redirect
(Server.Transfe r()) code in its Page_Load event.

What I can't figure out is how to get the POST data into the Request the
page will submit when it redirects to PayPal. What's the simplest way to do
this? Are there any examples? Thanks much.

David Veeneman
Foresight Systems
I have replied to this in a different newsgroup.

If you make a proper cross post instead of posting separate copies, you
will get a single thread instead of separate confused threads.
Nov 8 '06 #5

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

Similar topics

4
6477
by: Christian Galbavy | last post by:
Hello! My friend and I are working on a little program. It sends a local file to a server (php), we use the rfc1867 protocoll for this. When the server gets the data, it replies with some details about the transaction. Here is an output-example: ******************************************** E:\Studium\Multi\Projekt>java transfer size: 225308 HTTP/1.1 200 OK
2
20753
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none But the problem occures when i want to send a data with & sign (i.e: Firm=F&B). I try to solve this problem with using boundary, but i failed. Any idea!?
4
2909
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 - uses GET method. However I have to open remote server page using POST method. Normally this can be achieved using <form ACTION="remote-page-url"> tag. However this is impossible with ASP.NET. Also, using WebRequest class is not good solution, as I...
10
3444
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 database or continue to process on to the next page. I am now trying to learn ASP to see if we can replace some of our applications that were written in php with an ASP alternative. However, after doing many searches on google and reading a couple...
2
1521
by: jlopes151 | last post by:
Question: I'm creating an ASP.NET webform and I have questions about how the ASP.NET form works. In ASP or HTML a form with an action will transfer that forms items to another page. From the documentation I have read, there is nothing that describes the use of the forms action atribute. I did find text on the MSDN that describes the use of
12
1965
by: Britney | last post by:
Hi guys, in my default.aspx file, I have following code. when I go to browser, I enter values in both textboxs, then I hit submit Button, however, it didn't go to page2.aspx. instead, it was still in default page. I thought Action will direct page to page2.aspx, no??? <form id="Form1" method="post" runat="server" action="page2.aspx"> <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
0
3889
by: WIWA | last post by:
Hi, I want to login to a password protected website and fetch the content of the page behind. I have based my code on http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use tools like ieHTTPHeaders v1.6, and I perform a normal login (using the normal website), I see that the viewstate is __VIEWSTATE=dDwxMzU4OTE3NTA2Ozs%2BTK88jS63JXN181X3N8zKivua8co%3D&txt_username=xxx&txt_password=xxxxxx&btn_login=Login. When I...
12
3180
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without restarting the application. What I did was to create an AppDomain that loaded the plugins and everything was great, until I tried to pass something else that strings between the domains...
9
1456
by: Greg Stevens | last post by:
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,
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10127
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7665
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5552
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4336
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 we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.