Export (0) Print
Expand All

HttpRequest::AppRelativeCurrentExecutionFilePath Property

Updated: July 2009

Gets the virtual path of the application root and makes it relative by using the tilde (~) notation for the application root (as in "~/page.aspx").

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public:
property String^ AppRelativeCurrentExecutionFilePath {
	String^ get ();
}

Property Value

Type: System::String
The virtual path of the application root for the current request.

Use this property to provide URL information that will stay the same even if the application changes location. This allows the same URL-mapping code to be used in a test environment and in the final deployment environment, or to be used by copies of Web applications in different domains.

The following example uses the AppRelativeCurrentExecutionFilePath property to set the URL of an Image control to an image in the same directory as the page. Run this page at different levels of a directory structure to see the resulting AppRelativeCurrentExecutionFilePath property values.

No code example is currently available or this language may not be supported.

The following example uses the AppRelativeCurrentExecutionFilePath property to programmatically set the path to a resource, based on the current path of the page.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Date

History

Reason

July 2009

Simplified code example.

Customer feedback.

Community Additions

ADD
Show:
© 2014 Microsoft