Hi all!
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:
Code:
// 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);
context.Response.Write(charPdf);
According to MSDN
http://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[1000000] (bytePdf is 97665) but I still get the same exception.
Any pointers?
- mega
Moving to C# .NET