Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: ASPNET
Expertise: Intermediate
Mar 17, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

The MapPath method

The ASP.NET Page object exposes the MapPath method, which converts a virtual path into a physical path, so it' is useful for passing arguments to objects that don't work with virtual paths:

Dim sr As New System.IO.StreamReader(Me.MapPath("/data/values.dat"))
You can also use MapPath to retrieve information onabout the current ASP.NET application, for exampleas you see in this snippet:

' The current directory 
Dim currDir As String = Me.MapPath(".")
' The parent directory
Dim parentDir As String = Me.MapPath("..")
' The root directory
Dim rootDir As String = Me.MapPath("/")
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date