I have a asp.net website folder namely Website3 inside website3 folder there is a upload folder. I want to delete files inside upload folder on button click event.
MY directory status :
Website3 > upload
I’m using the following command but it doesn’t delete the file from upload directory
Protected Sub ListView1_ItemDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewDeletedEventArgs) Handles ListView1.ItemDeleted
Dim lab As Label = CType(ListView1.Items(ListView1.SelectedValue).FindControl("photoLabel"), Label)
System.IO.File.Delete(System.IO.Path.GetDirectoryName("/upload/") & lab.Text)
End Sub
You should be using Server.MapPath