1
If System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("images/TravelogueGallery/" & getMaxID())) Then
System.IO.Directory.Delete(HttpContext.Current.Server.MapPath("images/TravelogueGallery/" & getMaxID()), True)
End If
我使用上面的代碼片段刪除一個目錄,但我得到這個錯誤:資料夾刪除不工作
'G:\Projects\Latest\LTCIndia 05-04-12 1415\images\TravelogueGallery\19' is not a valid virtual path.
有什麼不好的代碼?
更新:我已經用正確答案更新了這個問題。上面的代碼片段工作得很好。謝謝你們的時間。
刪除刪除行上的MapPath。看看是否有幫助。 – asawyer 2012-04-05 23:26:39
http://stackoverflow.com/questions/942514/is-not-a-valid-virtual-path – 2012-04-05 23:28:31
可能的重複檢查你的相對路徑。 – coder 2012-04-05 23:29:13