1

I am working on asp.net MVC project.

I use ExcelDataReader component to read excel file records.

Now when I published my project to server and upload a .xlsx file with uploader I get below mentioned exception message. There are no errors with local deployment but server.

Access to the path '\Microsoft Corporation\Internet Information Services\7.5.7600.16385' is denied.

and code where I am getting error is:

if (personsFile.FileExtension == ".xls")
{
     Stream st = new MemoryStream(personsFile.FileArray);
     reader = ExcelReaderFactory.CreateBinaryReader(st);
}
else if (personsFile.FileExtension == ".xlsx")
{
     Stream st = new MemoryStream(personsFile.FileArray);
     //exception occured on under line
     reader = ExcelReaderFactory.CreateOpenXmlReader(st);
}

But when I upload a .xls file, I dont have any error.

How to resolve issue with .xlsx extenstion?

Pankaj Kapare
  • 7,486
  • 5
  • 40
  • 56
Mahdi Radi
  • 429
  • 2
  • 10
  • 30

1 Answers1

0

This is most likely due to ExcelDataReader 2.x extracting the xlsx archive to %TEMP% before processing it. The current pre-alpha of 3.0 no longer does this. See https://github.com/ExcelDataReader/ExcelDataReader/releases.

Johan Appelgren
  • 331
  • 1
  • 5