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' 不是有效的虚拟路径。

代码有什么问题?

更新:我已经用正确的答案更新了问题。上面的代码片段工作得很好。谢谢你们的时间。

4

1 回答 1

0
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

这是正确的答案。我已经用正确的答案更新了这个问题。上面的代码片段工作得很好。谢谢你们的时间。

于 2012-04-05T23:47:32.667 回答