views:

21

answers:

1

Hello All,

I want to send an email that has a machine readable part you cut and paste into an asp.net page and you get the information.

I have stored all the information in an object and then used an XMLSerizer to create some xml. It all worked fine until I added some Images as byte[] to the object.

If I dump the resulting string to disk then I can recreate the object fine but after it appears in the email client and I try to cut and paste it it never works.

Clearly there are non standard characters coming out that email clients don't like.

Is there some encoding I could apply to my XML that would make it display correctly in an email client? Then I could cut, paste, decode and deserilize to get my object back.

Please an example of how to encode the string in c# would be great.

+2  A: 

You need to encode your byte array to base64 before adding into the xml

string x = Convert.ToBase64(bytearray);

Raj
That didn't help at all infact it's worse now it never works.
barbary