LocalPath Property  
 

Return the full path to the local file or directory that is the target of the current request.

Syntax

object.LocalPath [ = filename ]

Remarks

The LocalPath property returns the full path to a local file name or directory that maps to the request URI provided by the client. For example, if the client sends the GET command to the server, this property will return the complete path to the local file that the client wants to download. This property will only return a value for those standard HTTP requests that perform some action on a file or directory, otherwise it will return an empty string.

Setting this property allows you to effectively redirect the client to use a different file than the one that was actually requested. If the path is absolute, then it will be used as-is. If the path is relative, it will be relative to the server root directory. The full path to this file is not limited to the server root directory or its subdirectory, it can specify a file anywhere on the local system. If this property is set to an empty string, then the server will revert to using the actual file or directory name specified by the command.

This property should only be set within an OnCommand event handler, and only for those requests that perform an action on a file or directory. If the current request does not target a file or directory, setting this property will cause an exception to be raised by the control. Exercise caution when using this property to redirect the server to use a different file than the one requested by the client; changing the target file may cause the client to behave in unexpected ways.

Data Type

String

See Also

VirtualPath Property, ResolvePath Method, OnCommand Event