I have a file path in the format file://SERVERNAME/FOLDER$/FOLDER/image.jpg
. I call System.IO.File.Delete(Server.MapPath(file://SERVERNAME/FOLDER$/FOLDER/image.jpg))
to delete the file, but i get the error file:/SERVERNAME/FOLDER$/FOLDER/image.jpg' is not a valid virtual path.
I notice that a '/' is missing and I do not know why. How will I delete such file?
I have tried converting my file path to file:////SERVERNAME//FOLDER$//FOLDER//image.jpg
but this did not help. Same thing happens. If I omit the Server.MapPath
, I get an error saying URI is not supported.
How to do this please?