First of all, if your array of bytes really represent some text data (the question is: where did you get it?),
ToString()
won't help you, it will return the string "System.Byte[]", instead of what you probably expected. This is a big mistake, but not the one you are reporting. The line you pointed out would not show the compilation error. You simply present wrong information on the error. Ether the line or the error message is different.
I have no idea why are you trying to stick
bytes
into some header and have no idea what is in this array. I can only guess that you want to create a header "Content-Length" showing the length equal to the data size, where your data is in
bytes
. Then you would need to use
Response.AddHeader("Content-Length", bytes.Length.ToString());
If your purpose is different, please feel free to clarify and ask some follow-up questions.
However, I would seriously advise you to gain some confidence on much simpler projects than the one you are trying to do. Better less but better.
—SA