SoloCodigo

CLR: .Net / Mono / Boo / Otros CLR => C# => Mensaje iniciado por: phisco123 en Domingo 10 de Julio de 2011, 18:55

Título: Delete a File.pdf - "File does not exist"
Publicado por: phisco123 en Domingo 10 de Julio de 2011, 18:55
Hey Guys,
 
I'm working on a webapplication and I'm saving files .pdf in a folder called "Files" inside of the application project...
 
So, I display these pdf files but I got a nasty problem, with delete them, It's driving me nuts....
 
because I every time I try to do it, I get this exception:
 
"File does not exist", It couldn't be found... BUT the goddamned File does exist..
 
In fact, I display this pdf file (with response.transmitfile) with the same string path and It works... but when I try to delete it with the methos from IO.. It doesn't work at all..
 
Here' part my code:
 
string path = @"Files" + "\" +filename.pdf;
if (File.Exists(path))
{
 
File.Delete(path);
 

 
elimino = true;
}
 
So, anybody knows how can I solve this problem???
 
Thanks...
Título: Re: Delete a File.pdf - "File does not exist"
Publicado por: gabio2 en Lunes 11 de Julio de 2011, 20:09
1)Could you put the code where you are saving the file?

2)Do you run your program in debug mode? for looking your mistake?

phisco greetings! :)