Request.InputStream and Request.Headers together - or - combing text w/ a stream
I am working with a multipart MIME message parser, using the SharpMimeTools library.
The MIME library is expecting to receive a stream, which it is getting from Request.InputStream.
However, it expects the stream to contain header information which is not in the Request.InputStream.
For testing, I wrote Request.InputStream to a text file, wrote Request.Headers to a string. I opened the tex开发者_高级运维t file, pasted in the headers and everything works as expected.
How can I add my header string to the beginning of my stream?
Is it possible to do this? To take a string and add it to the beginning of a stream.
If this is not a desired way to do it, is there a way to get the InputStream with the headers already appended?
Thanks!
Edit: This was the what I was using as a reference: http://blog.rueedlinger.ch/2009/01/net-c-and-soap-with-attachments/
Since he omitted the constructors @ the beginning, I wasn't sure where the source of the stream was. Turns out httpStream was my Request.Input stream and mimeStream was simply a new MemoryStream.
The actual binary append was done using a TextReader and TextWriter.
Consider this solved. The last iteration was it...
I'd posted the answer to this question in my original question.
精彩评论