473,396 Members | 2,102 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,396 software developers and data experts.

POSTing Data to another server

I am in a situation where I need to package some information from
Page1, submit it via POST to another server which will process the
information and then send the user to another page on my server
(Page2).

I have looked at HttpWebRequest (see code below) on numerous coding
websites but have not found a method that works. Does anyone have a
solution for this or has seen an example that works for this
situation?

Currently, I am using an HTML page that obviously goes away when it
performs the POST. I need the ASP.NET page to work the same way--send
the data and go away. The receiving server is configured to send data
back to a page on my server.

This is one very frustrating issue that I have with ASP.NET--the
postback architecture gets wrapped around itself for something like
this.
Thanks,
Mike

private void btnSubmit_Click(object sender, System.EventArgs e)
{
string bname = tbName.Text;
string baddr1 = tbAddress.Text;
string bcity = tbCity.Text;
string bstate = ddlState.SelectedItem.Value;
string bzip = tbZip.Text;
string phone = tbPhone.Text;
string email = tbEMail.Text;
string cctype = ddlCCType.SelectedItem.Value;
string cardnumber = tbCCNumber.Text;
string expmonth = ddlExpMonth.SelectedItem.Value;
string expyear = ddlExpYear.SelectedItem.Value;
string subtotal = lblCost.Text.Substring(1);
string tax = lblTax.Text.Substring(1);
string chargetotal = lblTotal.Text.Substring(1);

string postData = "bname=" + Server.UrlEncode(bname);
postData += "&baddr1=" + Server.UrlEncode(baddr1);
postData += "&bcity=" + Server.UrlEncode(bcity);
postData += "&bzip=" + Server.UrlEncode(bzip);
postData += "&phone=" + Server.UrlEncode(phone);
postData += "&email=" + Server.UrlEncode(email);
postData += "&cctype=" + Server.UrlEncode(cctype);
postData += "&cardnumber=" + Server.UrlEncode(cardnumber);
postData += "&expmonth=" + Server.UrlEncode(expmonth);
postData += "&expyear=" + Server.UrlEncode(expyear);
postData += "&subtotal=" + Server.UrlEncode(subtotal);
postData += "&tax=" + Server.UrlEncode(tax);
postData += "&chargetotal=" +
Server.UrlEncode(chargetotal);
postData += "&storename=XXXXXXXXXX";
postData += "&mode=payplus";
postData += "&txnorg=eci";
postData += "&bcountry=US";
postData += "&2000=submit";

HttpWebRequest postReq = (HttpWebRequest)
WebRequest.Create("https://staging.linkpt.net/lpc/servlet/lppay");
postReq.Method = "POST";
postReq.AllowAutoRedirect = false;
postReq.ContentType = "application/x-www-form-encoded";
postReq.ContentLength = postData.Length;

byte[] buffer = Encoding.UTF8.GetBytes(postData);
using (Stream reqst = postReq.GetRequestStream())
{
reqst.Write(buffer, 0, buffer.Length);
}
}
Jul 21 '05 #1
0 1604

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

Similar topics

6
by: anon | last post by:
Post Forwarding question...... For this control below, <asp:Button runat="server" PostTargetUrl="page2.aspx" /> The Attribute: PostTargetUrl="page2.aspx" Is this PostTargetUrl Attribute...
10
by: DaveFash | last post by:
Posting variables from an HTML FORM, via the Request.Form function on the receiving ASP page is great. But how can you POST a Form variable to an ASP page -- without a human pushing a Submit...
3
by: Brian Shannon | last post by:
Lets say I have web1.aspx which the user inputs data into txtData (text box). When the user clicks the button ADD the browser takes the user to web2.aspx. On web2.aspx I need to post the data...
2
by: ejs | last post by:
Please read the entire reponse, hopefully this clears up your questions. The data used that needs to go into the batchupload page comes from a server. My problem is that currently I write a file...
0
by: someone | last post by:
I am in a situation where I need to package some information from Page1, submit it via POST to another server which will process the information and then send the user to another page on my server...
0
by: Stefan Schwarzer | last post by:
Hi all! For my FTP library module ftputil , some users have asked for a way to avoid server timeouts (FTP status code 421). But I haven't found out yet how I can do this in all cases. I try...
5
by: dana lees | last post by:
Hi, I am writing a C# asp.net application. How can i post files to a web page? Can you please show an example? I have 3 input files: for example - <input type="file" size="40" id="file1"...
5
by: vaj | last post by:
Hey, Im creating a system on a pocket pc based on win ce 4.2 and i need to tranfer three datasets to a remote server on the network.Could anyone tell me the easiest way to do this? cheers, -vaj
0
by: kwilliams1130 | last post by:
I am having a problem with data that is being posted to another server. The problem is I collect the data from our database through an .cfm file (and all data is correct), which then the data is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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
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...

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.