Вы можете использовать методы File.Exists() and Directory.Exists()
, чтобы проверить вывод Server.MapPath()
и убедиться, что файл / каталог существует по указанному пути.
Dim myPath as String = Server.MapPath('/some/path.aspx')
If File.Exists(myPath) Then
//Do Something
Else
If Directory.Exists(myPath) Then
//Do Something
Else
//Invalid path
End If
End If