Hello everyone, here is my situation. I uploaded file to this directory on my hosting server outside my web application root:
/file
I created a virtual directory to access this by creating something like this:
www.example.com/document
So if there is an image in /file/test.jpg, I can access it by going to
www.example.com/document/test.jpg. Looking at this, I stored a path in my database as something like this "~/document/test.jpg". Now I want to delete this and here is my code:
Dim imageFile As FileInfo = New FileInfo(HttpContext.Current.Server.MapPath("~/document/test.jpg"))
If imageFile.Exists Then
File.Delete(HttpContext.Current.Server.MapPath(txtPath.Text))
End If
Did I do it correctly? This did not work for me. I tried to debug this locally but of cours ...
Go to the complete details ...