Name
PhysicalPath
Synopsis
stringvar = Request.PhysicalPath
Returns a String containing the physical path to the requested file.
Parameters
-
stringvar
A String variable to receive the physical path.
Example
The example writes the PhysicalPath property to the browser:
Sub Page_Load( ) Dim physicalPath As String physicalPath = Request.PhysicalPath Message.Text = "Physical Path = " & physicalPath End Sub
Notes
Unlike the PhysicalApplicationPath, which returns only the path to
the root of the application, the PhysicalPath property returns the
full physical path of the requested resource, including any
intervening folders and the resource’s filename.
This property may be useful in combination with
ASP.NET’s Trace functionality in troubleshooting
situations when files you are attempting to write to or read from are
not found, or when created files aren’t located
where you expect them to be. Adding Trace.Write statements to your
page to write the Path, PhysicalApplicationPath, and PhysicalPath
properties to the trace log (which you can enable by adding the
Trace="true"
attribute to the @
Page
directive) may help you track down such bugs.
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.