File locked after save? Won't load in editor...Help...Can't be deleted, changed etc...Thx!

Last post 06-11-2004, 4:44 PM by colin. 1 replies.
Sort Posts: Previous Next
  •  06-11-2004, 4:13 PM 1002

    File locked after save? Won't load in editor...Help...Can't be deleted, changed etc...Thx!

    Hi All,

     
    First off thanks for your help.
     
    This one has stumped me a bit...probably my bad, but could it be a bug?  Maybe the file stream left open in the session?
     
    I open an html file using:
     
         Editor1.LoadHtml(mydocument);
     
    Which works fine and loads the html file, then I make changes and save it using:
     
        Editor1.SaveFile(mydocument);
     
    When I then do an:
     
         Editor1.LoadHtml(mydocument);
     
    I get an empty editor, no html file data loads and when I try and open the html file in another editor I get a sharing violation error stating it's already in use by another program, also it won't let me delete it or change it from the operating system giving me the same error.  There's surely an easier fix, but the file currently stays locked until I reboot my workstation, then I can open it again.  I'm sure it's just something I don't understand. =)
     
    Note: If I don't save using Editor1.SaveFile(mydocument); I can open all files to my hearts delight, no problem.  Is the stream being left open in the session somehow after the save?
     
    Any thoughts are much appreciated!
     
    Cheers,
     
    -Colin
     
    P.S. I have the permissions set correctly for asp.net, IUsr etc...etc... and read and write to html files in this directory on a regular basis using asp.net.
  •  06-11-2004, 4:44 PM 1003 in reply to 1002

    Re: File locked after save? Won't load in editor...Help...Can't be deleted, changed etc...Thx!

    Hi All,

     
    For the moment I have replaced
     
        Editor1.SaveFile(mydocument); 
     
    with
     
        SaveHtml(mydocument);
     
    And
     
         public void SaveHtml(String FilePath)
         {
               StreamWriter sw = new StreamWriter(Server.MapPath(FilePath));
               sw.Write(Editor1.Text);
               sw.Close();
         }
    Which seems to do the trick!  Thought I'd include it in case it's helpful.
     
    Cheers,
     
    -Colin
     
View as RSS news feed in XML