M
MA
Hi all!
I created a webservice that check folder for incoming and outgoing files. If
a file exists in my inbox (incoming file) I read it and want to delete it.
It looks like this:
foreach(FileInfo fname in folder.GetFiles())
{
if(fname.Exists)
{
myStream = new StreamReader(fname.FullName,Encoding.Default);
string line = myStream.ReadLine();
while(line != null)
{
content += line;
line = myStream.ReadLine();
}
myStream.Close();
fname.Delete();
}
It works except for fname.Delete();
I get an access denied on this. The file is not read-only if I check
properties in Explorer.
How can I fix this?
/Marre
I created a webservice that check folder for incoming and outgoing files. If
a file exists in my inbox (incoming file) I read it and want to delete it.
It looks like this:
foreach(FileInfo fname in folder.GetFiles())
{
if(fname.Exists)
{
myStream = new StreamReader(fname.FullName,Encoding.Default);
string line = myStream.ReadLine();
while(line != null)
{
content += line;
line = myStream.ReadLine();
}
myStream.Close();
fname.Delete();
}
It works except for fname.Delete();
I get an access denied on this. The file is not read-only if I check
properties in Explorer.
How can I fix this?
/Marre