Server Error in '/R' Application.
--------------------------------------------------------------------------------

Microsoft Office Excel cannot access the file 'C:\inetpub\wwwroot\R\R.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. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.InteropServices.COMException: Microsoft Office Excel cannot access the file 'C:\inetpub\wwwroot\R\R.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.

Source Error: 


Line 16:         '   System.IO.File.Delete("D:\R.xlsx")
Line 17:         'End If
Line 18:         oBooks = oExcel.Workbooks.Open(Server.MapPath("/R/R.xlsx"))
Line 19:         oExcel.Cells(1, 2) = "Ah"
Line 20:         System.Threading.Thread.CurrentThread.CurrentCulture = oldCI
 

Source File: C:\inetpub\wwwroot\R\R.aspx    Line: 18 

Stack Trace: 


[COMException (0x800a03ec): Microsoft Office Excel cannot access the file 'C:\inetpub\wwwroot\R\R.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.]
   Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad) +0
   ASP.r_aspx.Page_Load(Object Sender, EventArgs E) in C:\inetpub\wwwroot\R\R.aspx:18
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +48
   System.Web.UI.Control.OnLoad(EventArgs e) +133
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2604

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 