How to store Excel, CSV file in temporary storage like cookies, session in .Net core mvc c#

Viewed 34

I store IFormfile in static class and convert it into memory stream but it shows this error:

System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'FileBufferingReadStream'.'

using (MemoryStream stream = new MemoryStream())            
{
   IFormFile tempFile = ExcelDataValidation.DLExcelFile; 
   tempFile.CopyTo(stream); //Error shows here
}
0 Answers
Related