Tag Archives: Path

Get the Current Directory

I hate trying to remember this so here are various options.

If you are writing an application:

Return Application.StartupPath


Dim uri As String = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
Dim local As String = New Uri(uri).LocalPath
Return local

If you are writing a class library:

Return My.Application.Info.DirectoryPath

If you are writing an ASPX page:

Dim serverfilepath As String = Server.MapPath(filepath)