This documentation is archived and is not being maintained.
Page.MapPath Method
.NET Framework 1.1
Retrieves the physical path that a virtual path, either absolute or relative, maps to.
[Visual Basic] Public Function MapPath( _ ByVal virtualPath As String _ ) As String [C#] public string MapPath( string virtualPath ); [C++] public: String* MapPath( String* virtualPath ); [JScript] public function MapPath( virtualPath : String ) : String;
Parameters
- virtualPath
- A String that represents the virtual path.
Return Value
The physical path associated with the virtual path.
Example
[Visual Basic, C#] The following example uses the MapPath method to obtain the physical path of a subfolder. It then uses this information to set the Text property of a TextBox Web server control.
[Visual Basic] Dim fileNameString As String = Me.MapPath(subFolder.Text) fileNameString += "\\" + fileNameTextBox.Text [C#] String fileNameString = this.MapPath(subFolder.Text); fileNameString += "\\" + fileNameTextBox.Text;
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Show: