That won't work because the stream is read-once. You'll be at the end of the stream.
Viv's idea is the right one - read the stream to a string (or to some other stream like a TextWriter), adjust if needed then use Load() to explicitly load the string... Unless the XML is enormous this is very fast - what's slow is the IO operations of reading the data from the stream over the network.
+++ Rick ---
>public static string getElementValue(string elementName,Stream stream)
> {
> StreamReader reader = new StreamReader(stream);
> string fileInfo = reader.ReadLine();
> XDocument doc = XDocument.Load(stream);
> return (from element in doc.Descendants(elementName)
> select element).Single().Value;
> }
>
>and in debug fileinfo is empty. Would I expect to see a response in there ? Can I access this stream like that ?
>
>Update I changed readline to ReadToEnd and now I can see its returning a web page which is wrong. thats some progress I guess