VirtualPath Property  
 

Return the virtual path to the local file or directory that is the target of the current command.

Syntax

object.VirtualPath [ = filename ]

Remarks

The VirtualPath property returns the virtual path to the resource requested by the client. For example, if the client sends the GET command to the server, this property will return the complete virtual path to the local resource that the client wants to download. This property will only return a value for those 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 resource 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. 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 command 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.

To instruct the client to use a different resource URI, it is recommended that you use the RedirectRequest method rather than modifying the value of this property.

Data Type

String

See Also

LocalPath Property, RedirectRequest Method, ResolvePath Method, OnCommand Event