473,659 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble Performing An HTTP POST

Hi there. I'm having trouble with an HTTP Post in my code behind. Can
anyone help?

Here's my code:
string data = "&fields_fn ame = " + txtFirstName.Te xt + "&fields_lname= "
+ txtLastName.Tex t;
string url = "http://localhost/app/default.asp";

WebRequest objWebRequest = WebRequest.Crea te(url);
objWebRequest.M ethod = "POST";
objWebRequest.C ontentType = "applicatio n/x-www-form-urlencoded";

byte[] bytes = System.Text.Enc oding.ASCII.Get Bytes (data);
objWebRequest.C ontentLength = bytes.Length;

Stream outputStream = objWebRequest.G etRequestStream ();
outputStream.Wr ite (bytes, 0, bytes.Length);
outputStream.Cl ose ();

Sep 28 '06 #1
1 1823
Whats the trouble your having with it?

The first thing I notice is that you start your data with a &, you dont
need one in front.

Other than that, whats the problem?

Sean
rh120...@gmail. com wrote:
Hi there. I'm having trouble with an HTTP Post in my code behind. Can
anyone help?

Here's my code:
string data = "&fields_fn ame = " + txtFirstName.Te xt + "&fields_lname= "
+ txtLastName.Tex t;
string url = "http://localhost/app/default.asp";

WebRequest objWebRequest = WebRequest.Crea te(url);
objWebRequest.M ethod = "POST";
objWebRequest.C ontentType = "applicatio n/x-www-form-urlencoded";

byte[] bytes = System.Text.Enc oding.ASCII.Get Bytes (data);
objWebRequest.C ontentLength = bytes.Length;

Stream outputStream = objWebRequest.G etRequestStream ();
outputStream.Wr ite (bytes, 0, bytes.Length);
outputStream.Cl ose ();
Sep 28 '06 #2

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

Similar topics

3
4081
by: special_agent69 | last post by:
Not sure if this is a stoopid question or not. If it is, my apologies. I'd like to have an ASP form performing a relatively simple calculation. For example, if I wanted to create a simple order form where someone enters a quantity of tickets, the form would automatically calculate the total cost in a second text box based on the number (qty) entered times the cost of a single ticket. Such that, if the user entered "2" in one text box,...
8
7624
by: John | last post by:
Here is the current error that im getting when building my solution. The only thing i can think of is that i needed to install visual studio 6 after visual studio .net was already installed to print out some forms that were created in vs6 causing this issue to occur. I may be way off here but that is why i'm posting this message. Performing Post-Build Event... Access is denied. 0 file(s) copied. Project error: A tool returned an error...
2
2250
by: Glenn Venzke | last post by:
I'm trying to put together a web form that lists all current session information. The session info is stored in SQL server database (ASPState) and I'm trying to retreive and display using a SQLDataReader. I seem to have no trouble querying the "ASPStateTempSessions" table but when I try to write it to the page, I throw an exception that basically says that there is no data to display. Is there some special method you must use when performing...
6
3784
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
3
4995
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
59
7490
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when the recordset opens a table. When I write Set rst = db.OpenRecordset("MyTable",dbOpenTable, dbReadOnly) I get an error. I believe it's invalid operation or invalid parameter, I'm
6
2254
by: Gonzalo Monzn | last post by:
Hi all! I have been translating some Python custom C extension code into Python, as I need these modules to be portable and run on a PocketPC without the need of compile (for the purpose its a must 2.4 as it is the last PythonCE release with great improvements). But I've been stuck with a script wich does not work as expected once translated to python, 2.4
10
8147
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine and excel is closed. But there are some commented lines: //xlSeries.XValues = xlWs.get_Range("B2", "B4"); // makes com objects, but which...
1
8227
by: suniladhyaru | last post by:
Hi All, Could you help me solving this problem ?? error PRJ0019: A tool returned an error code from "Performing Post-Build Event..." Regards, Sunil Adhyaru
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8851
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
8747
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...
1
8528
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
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...
0
7356
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
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
5649
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();...
2
1976
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.