|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Delete a fileI have a problem when trying to delete a file. I have to extract some information from a file, and then I have to delete it. When I try to delete it after I read it, I get a "Access denied" error. help pls, Neven ******************************** StreamReader sr = new StreamReader(sFolderArhiva + sShortFileName); while ((sLine = sr.ReadLine()) != null) { try { if (sLine.Substring(0, "ApplicationItem=".Length) == "ApplicationItem=") { docType = DohvatiTipDokumenta_TipDokumenta(sLine.Substring("ApplicationItem=".Length)); } } catch (){} try { if (sLine.Substring(0, "ApplicationTag=".Length) == "ApplicationTag=") { ID = sLine.Substring("ApplicationTag=".Length); } } catch {} } sr.Close(); sr.Dispose(); ------------ try { File.Delete(sFolderArhiva + sShortFileName); } catch {} Hello, Neven!
NK> I have a problem when trying to delete a file. NK> I have to extract some information from a file, and then I have to NK> delete it. When I try to delete it after I read it, I get a "Access NK> denied" error. Maybe you do not have enough permissions to delete that file, check file's ACL. [skipped] Thanks, I solved this one.
The file had readonly property turned on Neven Show quote "Vadym Stetsyak" <vady***@ukr.net> wrote in message news:OAm6eMk1GHA.4976@TK2MSFTNGP02.phx.gbl... > Hello, Neven! > > NK> I have a problem when trying to delete a file. > > NK> I have to extract some information from a file, and then I have to > NK> delete it. When I try to delete it after I read it, I get a "Access > NK> denied" error. > > Maybe you do not have enough permissions to delete that file, check file's > ACL. > > [skipped] > > > -- > Regards, Vadym Stetsyak > www: http://vadmyst.blogspot.com |
|||||||||||||||||||||||