I want to open server excel as a workbook in client machine but i am not able to open it, but with same code it is working perfectly on local machine.
My c# code is as under
string physicalFileName1 = "";
hfDrive.Value = ConfigurationManager.AppSettings["Patientuplao"].ToString();
string filename = txtfile1.Text;
physicalFileName1 = hfDrive.Value + "\\" + filename + "\\PatientChart.xls";
if (txtfile1.Text != "")
{
try
{
physicalFileName1 = hfDrive.Value + "\\" + filename + "\\PatientChart.xls";
var excelapp = new Microsoft.Office.Interop.Excel.Application();
excelapp.Visible = true;
Microsoft.Office.Interop.Excel.Workbooks wbook = excelapp.Workbooks;
Microsoft.Office.Interop.Excel.Workbook sheet = wbook.Open(physicalFileName1);
}
catch (Exception ex)
{
txtMessage.Text = ex.Message.ToString();
}
}
after this implementation i got this error
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
it seems that the user that is running the website (you are using asp.net) doesn't have the permission on the desired workbook. Try to change the permissions on the workbook on the server and add the user that is running the website.
User contributions licensed under CC BY-SA 3.0