tags:

views:

1862

answers:

4

This is not working:

byte[] tgtBytes = ...

Response.Write(tgtBytes);
A: 

If you want to output hex values

byte[] tgtBytes = ...
foreach (byte b in tgtBytes)
    Response.Write("{0:2x}", b);

Or do you want to do;

Response.Write(System.Text.Encoding.ASCII.GetString(tgtBytes));

To convert the bytes to ASCII text and output a string.

Dead account
+2  A: 
Response.OutputStream.Write(tgtBytes, 0, tgtBytes.Length);
Fabian Vilers
+11  A: 

You're probably looking for:

Response.BinaryWrite(tgtBytes);

MSDN documentation here.

Andrew Barrett
A: 

Another Solution it might be useful :

Response.OutputStream.Write(tgtBytes, 0, tgtBytes.Length);
khaled