We have created console application in C#, where will read multi-page tif/tiff files, splitting pagewise and then convert into base64 encoding to upload the file in other target application (as this accepts only base64 encoding to upload the documents) and we are getting this Out of Memory Exception whenever file size exceeded more than 500 MB Exception of type 'System.OutOfMemoryException' was thrown
Exception at System.Convert.ToBase64String(Byte[] inArray, Int32 offset, Int32 length, Base64FormattingOptions options)
at System.Convert.ToBase64String(Byte[] inArray)
Code Snippet:
Byte[] bytes = File.ReadAllBytes(filepath);
String base64stringofdocument = Convert.ToBase64String(bytes);
Above filepath refers > absolute path of the file