Using C# and ASP.NET, I'm trying to read an Excel file on server via Microsoft Interop, apply some processing to it, save it then download it on client machine. On local host, it works fine but on client machine it displays this message
Server Error in '/' Application.
Microsoft Office Excel cannot access the file 'C:\inetpub\wwwroot\ICNMS\Mysheet.xlsx'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
Here is my code:
Microsoft.Office.Interop.Excel.Application objApp;
Microsoft.Office.Interop.Excel.Workbook workBook;
Microsoft.Office.Interop.Excel.Sheets objSheets;
Microsoft.Office.Interop.Excel._Worksheet workSheet;
Microsoft.Office.Interop.Excel.Range range;
objApp = new Microsoft.Office.Interop.Excel.Application();
workBook = objApp.Workbooks.Open("Mysheet.xlsx", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, false, false);
The Excel file's path doesn't exceed 218 characters and isn't opened or used by any other application.By the way, the file exists in the same directory as the web page's. Any help would be very much appreicated.Thanks in advance.