Possible virtual paths:
/folder1/folder2/image.jpg
~/folder1/folder2/image.jpg
folder1/folder2/image.jpg
Concrete path:
C:\folder1\folder2\image.jpg
D:\folder1\folder2\image.jpg
C:/folder1/folder2/image.jpg
C:/folder1\folder2/image.jpg
How do you check whether a path is virtual or not in a way that's not prone to failure? The reason why I'm asking is because when I use Server.MapPath()
on a concrete path, it will throw an exception. However, what I'm passing to Server.MapPath()
can be any one of the examples I provided above and I don't know what it is before run-time.