I am writing the c# component of a .aspx page which an external site will be sending XML to. My page needs to be able to receive the XML and parse it, but I am getting hung up on receiving the XML.
My page is getting hit with the XML page, but Request.Files.Count==0 and Request.InputStream.Length==0, even though I know that both of these statements should be false because the page is logging the reception of the file and HttpContext.Current != null. I am using the following code:
Stream stream = HttpContext.Current.Request.InputStream;
stream.Position = 0;
XmlTextReader reader = new XmlTextReader(stream);
log("" + Request.Files.Count, tw);
log("Does the current request exist?",tw);
log(HttpContext.Current != null ? "Yes" : "No",tw);
log("XML Retrieved!", tw);
log("Byte Length of " + stream.Length, tw);
My log.txt file has the following output:
0
Does the current request exist?
Yes
XML Retrieved!
Byte Length of 0