HttpRequest.ApplicationPath Property
Assembly: System.Web (in system.web.dll)
Use this property to construct a URL relative to the application root from a page or Web user control that is not in the root directory. This allows pages and shared controls that exist at different levels of a directory structure to use the same code to link to resources at fixed locations in the application.
The following example uses the Write method to HTML-encode and then write the value of the ApplicationPath property to a text file. This code example is part of a larger example provided for the HttpRequest class. It assumes the existence of a StreamWriter object named sw.
The following example uses the ApplicationPath property to programmatically construct a path to a resource that is in a fixed location in the application. The page that references the resource does not have to be located in the same directory as the resource.