
334
|
Chapter 16: The HttpRequest Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Example
The example writes the PhysicalApplicationPath property to the browser:
Sub Page_Load( )
Dim physAppPath As String
physAppPath = Request.PhysicalApplicationPath
Message.Text = "Physical Application Path = " & physAppPath
End Sub
Notes
This property is useful when you need to create or write to a file within your web
application. Rather than hardcoding a filesystem path in your page, you can use
this property in combination with a filename to create or edit a file in the same
folder as the page containing the code, regardless of the page’s location.
PhysicalPath
stringvar = Request.PhysicalPath
Returns a string containing the physical path to the requested file.
Parameter
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 ...