I'm having problems with the ToBase64CharArray method of the Convert class. I have a ashx page that supposed to get a pdf file from db.
My code looks like this:
// get the pdf blob and write in to the http stream
byte bytePdf = (byte)dal.OpenQueryScalar("GetContractInfo", contractParam);
char charPdf = new char[bytePdf.Length];
Convert.ToBase64CharArray(bytePdf, 0, bytePdf.Length, charPdf, 0,Base64FormattingOptions.None);
According to MSDNhttp://msdn2.microsoft.com/en-us/library/3d0e5t57.aspx
it should be right, but I keep getting an ArgumentOutOfRange exception on offsetOut. I've tried to set charPdf (bytePdf is 97665) but I still get the same exception.
Moving to C# .NET