fishrich
asked on
Convert a string to memorystream to stream to client
Hello.
I have a string containing some xml, what is the best way to throw that string into a memory stream? I want to to do this so then I can stream that memory stream to the client browser -- I already know how to do that part.
Thanks.
I have a string containing some xml, what is the best way to throw that string into a memory stream? I want to to do this so then I can stream that memory stream to the client browser -- I already know how to do that part.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I wonder if this is a side effect of the Unicode encoding. Try changing this line:
Dim objEncoding As Encoding = Encoding.Unicode
To this:
Dim objEncoding As Encoding = Encoding.Ascii
Unicode uses 2-bytes for each character. And coincidentally, your file is missing 2 bytes. So this may be the cause of the problem.
Jeff
Dim objEncoding As Encoding = Encoding.Unicode
To this:
Dim objEncoding As Encoding = Encoding.Ascii
Unicode uses 2-bytes for each character. And coincidentally, your file is missing 2 bytes. So this may be the cause of the problem.
Jeff
ASKER
That worked! Thanks.
Glad I could help!
Jeff
Jeff
ASKER
This seems to ok up to the point I want to open up the file that has been saved. It seems to be missing 2 leading characters that make the file legit. If I open the file up in notepad, then save it, notepad will add those 2 characters to the beginning of the file and then I will be open to open the XML file in IE. If I just open the saved file in IE, IE will not read it.
I compared the two files in VC++ binary editor and the difference is, the working file has FF EE then the rest of the data. The corrupt file does not have that FF EE - is there a way to fix this in the .net code?