ok, heres the problem.. i have an asp.net page that im using to kind of
relay information back and forth. So on the Page_Load i make a request to a
webservice and return some xml back to the first calling app. now... i wrote
a test app to try it out, but i cannot get the proper data from it. It
always says the the ContentLength is -1 so my my StreamReader.ReadToEnd
throws an exception.. heres the chunk of code in the driver app:
webRequest = (HttpWebRequest)WebRequest.Create(webRequestServer );
webRequest.Method = "POST";
webRequest.ContentLength = doc.InnerXml.Length;
webRequest.ContentType = "text/xml";
webRequest.KeepAlive = false;
myWriter = new StreamWriter(webRequest.GetRequestStream());
myWriter.Write(doc.InnerXml.ToString());
myWriter.Close();
webResponse = (HttpWebResponse)webRequest.GetResponse();
StreamReader myReader = new StreamReader(webResponse.GetResponseStream());
responseFromServer = myReader.ReadToEnd();
myReader.Close();
Im thinking the problem is on the asp page. A weird thing i came across is
that it wont let me do a XmlDoc.Save on the response. so what i end up doing
is this:
myXMLDoc.LoadXml("xmlString")
responseXML = myXMLDoc.DocumentElement
Response.Clear()
Response.BufferOutput = True
Response.ContentType = "text/xml"
responseXML.WriteTo(New XmlTextWriter(Response.Output))
Response.Flush()
Response.Close()
I tried adding and appending a ContentLength Header to the response, but no
good.. and you can set the content-type fine. but there is no property for
Content-Length.
so what do i do
thanx for any help