473,385 Members | 1,908 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,385 software developers and data experts.

Use Request to receive xml data that send by using HttpWebRequest,

Here are my sending data part of the code:
-----------------------------------
XmlTextWriter myWriter = null;
HttpWebRequest myRequest;

XmlTextReader myXMLReader = null;
XmlDocument myDoc = null;

myDoc = new XmlDocument();
myDoc = Miscellaneous.CreateXMLDoc(); // will return a xml doc

// post xml file
myRequest =
(HttpWebRequest)WebRequest.Create("http://localhost:2772/Default.aspx");

myRequest.Method = "POST";
myRequest.ContentType = "text/xml";
myRequest.KeepAlive = false;
try
{
myWriter = new
XmlTextWriter(myRequest.GetRequestStream(),System. Text.Encoding.UTF8);
//myDoc =
Miscellaneous.CreateXMLDoc(txtLogin.Text,Submissio nInfo.StrPasswd);
myDoc.WriteContentTo(myWriter);
myWriter.Flush();
myWriter.Close();
}.............

Here is my receving data code in Default.aspx.cs file
---------------------------------------------------------
// Get input from client
HttpContext con = Context;
HttpRequest httpReq = con.Request;
httpReq.ContentType = "text/xml";
httpReq.RequestType = "GET";

XmlTextReader myXMLReader = new
XmlTextReader(httpReq.InputStream);

if (httpReq.InputStream.Length != 0)
{
}

The problem is the length of httpReq.InputStream is 0. Can you tell me
what's wrong?

Thank you very much in advance,
Ying
Jun 27 '08 #1
0 1095

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

Similar topics

0
by: Cenray | last post by:
How to generate a web request from a Winform Application using a WebService? In a C# Windows Application, when I try to genrate a web request using the following code, it is woking fine ...
3
by: Paul M | last post by:
Hi Sorry if this is posted in the wrong group but I'm brand new to this area. Basically I've got to post some XML documents to an external server using HTTP web request (POST, not GET) and be able...
3
by: ME | last post by:
Hi; I am getting "Unhandled Exception: System.Net.WebException: The remote server returned an erro r: (401) Unauthorized." when I am trying to get a page via post. Code follows...
7
by: Mullin Yu | last post by:
I want to submit a utf-8 xml request to a servlet by the following coding. it seesm that the servlet can't recognize it correctly. can i just using string postData = "..... utf-8 data" and then...
1
by: Bhupesh Saini | last post by:
I am trying to call a ASPX page using HttpWebRequest class and pass cookie information to it. My ASPX pages gets called just fine, however none of the request cookies are available to the ASPX page....
6
by: Georg | last post by:
Hello, I am trying to load a web page over a HTTP proxy with the POST method and I am using the following code: // open request (string url) HttpWebRequest httpWebRequest =...
2
by: Basel | last post by:
Hi All! My code issues Http POST requests in a loop using HttpWebRequest, I set one unique ConnectionGroupName, and I expected from the client to open one underlying persistent connection for...
6
by: Rushwire | last post by:
Does anybody know how to send a meeting request using an ics/vcs (VCalendar) attachment from an asp.net page. I don't want my users to have to double click on the attachment but rather that it is...
0
by: Mateo | last post by:
Hi! I have communication from asp.net aplication with some service on other server.... I send them data, and they return me some data. I have to take recived data and forward it to third server...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.