i have created an asp.net website using c#,when the button is clicked,the values from the webpage are stored into an excel sheet in the system,this works fine when done locally,but,when accessing from the client machine,within the intranet,it shows an error saying:
"file path is invalid or the file is already open",
how can make the excel sheet open and the data be saved in the client machine? pls help.
this is my code:
Excel._Application myExcelApp;
Excel.Workbooks myExcelWorkbooks;
Excel.Workbook myExcelWorkbook;
// Excel ._Worksheet myExccelWorksheetToChange;
object misValue = System.Reflection.Missing.Value;
myExcelApp = new Excel.Application();
myExcelApp.Visible = true;
myExcelWorkbooks = myExcelApp.Workbooks;
String fileName = "D:\\marks.xlsx";
myExcelWorkbook = myExcelWorkbooks.Open(fileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true);
// string name = System.IO.Path.GetTempPath()+Guid.NewGuid().ToString()+".xlsx";
Excel.Worksheet myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.ActiveSheet;
// myExcelWorksheet.SaveAs("marks");
String cellFormulaAsString = myExcelWorksheet.get_Range("A2", misValue).Formula.ToString();
myExcelWorksheet.get_Range("A1", misValue).Formula = TextBox1.Text;