However when the StreamReader code executes there is no data returned because the stream has now reached the end. I tried to reset the stream via stream.Position = 0 but this throws an exception (I think because the stream can't have its position changed manually).

Basically, I would like to parse the stream for XML and have access to the raw data (in string format).

One tiny suggestion here - I often see calls to Seek where the Position property would be simpler and more readable, e.g. ms.Position = 0; Just a thought for future code.
– Jon SkeetSep 29 '08 at 9:42

8

Another comment - the above doesn't end up closing the incoming stream, ever. It might be worth creating a "CopyAndClose" method which does close the stream, just so you could keep the simple calling syntax.
– Jon SkeetSep 29 '08 at 9:43

Wow, coming close to my heroes.. I'm currently reading your book, Mr. Skeet :-) What you suggested about closing (and telling with the method name) is exactly what I thought about the above code.
– VVSSep 29 '08 at 10:16