Pop3 Client fails to save attachment

I'm reading an email with Pop3, then read the attacment into a MemoryStream so that I can use xPath to pull the vales and use them. If you save the file to disk and the load it works fine.

BUT!!!

If you save it to a stream (rather than disk) and then try load that stream, this throws an error. I dont think the Stream is being loaded correctly

[CODE]
Aspose.Network.Mail.Attachment attachment ..........


XmlDocument doc = new XmlDocument();
attachment.Save("c:\\ " + attachment.Name));
doc.Load("c:\\ " + attachment.Name);
XmlNodeList promo = doc.SelectNodes("AUDITION/PROMOTION");
msgBox =promo.InnerText; -- WORKS FINE
----------------------------------------------

XmlDocument doc1 = new XmlDocument();
MemoryStream memStream = new MemoryStream();
attachment.Save(memStream);
doc.Load(memStream);
FAILS to load - NO ROOT NODE

XmlNodeList promo1 = doc.SelectNodes("AUDITION/PROMOTION");
msgBox =promo1.InnerText;

Hi ivansager,

Thank you for your post!

Our developers are tracing the problem and will back to you ASAP.Thanks.

hello Ivansager,

Thank you for your post! the reason for that exception is because the memory stream’s position is at the end. Please try this:

memStream.Seek(0, SeekOrigin.Begin);

before you load the memory stream into XmlDocument.


Best regards.

Thanks that worked!