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.Re adToEnd
throws an exception.. heres the chunk of code in the driver app:
webRequest = (HttpWebRequest )WebRequest.Cre ate(webRequestS erver);
webRequest.Meth od = "POST";
webRequest.Cont entLength = doc.InnerXml.Le ngth;
webRequest.Cont entType = "text/xml";
webRequest.Keep Alive = false;
myWriter = new StreamWriter(we bRequest.GetReq uestStream());
myWriter.Write( doc.InnerXml.To String());
myWriter.Close( );
webResponse = (HttpWebRespons e)webRequest.Ge tResponse();
StreamReader myReader = new StreamReader(we bResponse.GetRe sponseStream()) ;
responseFromSer ver = myReader.ReadTo End();
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.LoadXm l("xmlString" )
responseXML = myXMLDoc.Docume ntElement
Response.Clear( )
Response.Buffer Output = True
Response.Conten tType = "text/xml"
responseXML.Wri teTo(New XmlTextWriter(R esponse.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