• Domingo 22 de Diciembre de 2024, 18:05

Autor Tema:  Delete a File.pdf - "File does not exist"  (Leído 1385 veces)

phisco123

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Delete a File.pdf - "File does not exist"
« en: Domingo 10 de Julio de 2011, 18:55 »
0
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...

gabio2

  • Miembro MUY activo
  • ***
  • Mensajes: 402
  • Nacionalidad: mx
    • Ver Perfil
Re: Delete a File.pdf - "File does not exist"
« Respuesta #1 en: Lunes 11 de Julio de 2011, 20:09 »
0
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! :)
@gabio87