Excel 2010 Access to path is denied temp

Posted by Chris Anderson on Stack Overflow See other posts from Stack Overflow or by Chris Anderson
Published on 2011-01-06T18:45:01Z Indexed on 2012/04/03 23:28 UTC
Read the original article Hit count: 327

Filed under:
|
|

I am using excel data reader to read data from an excel file.

FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
//1. Reading from a binary Excel file ('97-2003 format; *.xls)
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
//2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);

http://exceldatareader.codeplex.com/

This reads excel 1997-2003 format and excel 2007 format on my local machine and when we move it to our test server.

However, when moved to production, it works for excel 97-2003 files, but when I try to read 2007 files I receive the following error:

Access to the path 'C:\Documents and Settings\PORTALS03\ASPNET\LOCALS~1\Temp\TMP_Z129388041687919815' is denied.

How is it possible that the 97-2003 excel file can be read but the 2007 files throw access is denied?

© Stack Overflow or respective owner

Related posts about c#

Related posts about excel