locked
The process cannot access the file because it is being used by another process(Error) RRS feed

  • Question

  • hi 

    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.Move(String sourceFileName, String destFileName) at Contractual_Info.Generate_Employee_Schedule(String Module, Int64 Moduleid, Int64 ConfirmID) in c:\inetpub\wwwroot\SmartWork_Portal\Contractual_Info.aspx.cs:line 849 at Contractual_Info.Btn_Submit_Esign_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\SmartWork_Portal\Contractual_Info.aspx.cs:line 695 at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Exception Type:

    System.IO.IOException

    asp .net error

    how to solve that problem.......

    FileName = dt_sel.Rows[0]["Contractor_Nmae"].ToString() + dt_sel.Rows[0]["Client_ID"].ToString() +"Schedule"+ ".pdf";
                FileNameNew = dt_sel.Rows[0]["Contractor_Nmae"].ToString() + dt_sel.Rows[0]["Client_ID"].ToString() +"Schedule"+ ".pdf";
                while (File.Exists(Server.MapPath("~/ViewDetails/") + FileNameNew))
                {
                    Random_Filename rd = new Random_Filename();
                    FileNameNew = dt_sel.Rows[0]["Contractor_Nmae"].ToString() + dt_sel.Rows[0]["Client_ID"].ToString() +"Schedule"+ rd.GetFilename() + ".pdf";
                }

                if (File.Exists(Server.MapPath("~/ViewDetails/") + FileName))
                {
                    Thread.Sleep(1000);
                    File.Move(Server.MapPath("~/ViewDetails/") + FileName, Server.MapPath("~/ViewDetails/") + FileNameNew); -------------   error line
                    Thread.Sleep(1000);
                    File.Delete(Server.MapPath("~/ViewDetails/") + FileName);
                   
                }
                 PdfWriter.GetInstance(document, new FileStream(Server.MapPath("~/ViewDetails/") + FileName, FileMode.Create));
             





    • Edited by vicky0505 Tuesday, June 23, 2015 1:03 PM
    Tuesday, June 23, 2015 1:00 PM

Answers

  • vicky0505 --

    I believe you have erroneously posted your question in a user forum dedicated to questions about Microsoft Project Server, an enterprise project management application.  I would recommend you repost your question in a more relevant user forum.  Hope this helps.


    Dale A. Howard [MVP]

    Tuesday, June 23, 2015 1:20 PM