Get executing application programmatically

I always have difficulty remembering how to find the name and directory of the executing application or website.  Here is the breakdown for reference.  More to come

 

Get Directory of current application root - System.Web.HttpContext.Current.Server.MapPath("")

Get Directory of current application – System.Web.HttpContext.Current.Request.PhysicalApplicationPath

Get Directory of current page request (entire path) - Request.MapPath(Request.QueryString["filename"])

Get name of the current assembly - System.Reflection.Assembly.GetEntryAssembly().GetName().Name

Get executing assemblies location (.dll files in temp) - Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)

Published Monday, November 29, 2010 12:11 AM by Kiyoshi
Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)