Directory Property  
 

Get and set the full path to the root directory assigned to the server.

Syntax

object.Directory [ = pathname ]

Remarks

The Directory property returns the path to the root directory for the server. If this property is set to the name of a valid directory before the server is started, that directory will be considered the root directory for the server. If this property is not set, or is set to an empty string, then the server will use the current working directory as its root directory, however this is not recommended. It is recommended that you specify an absolute path to the directory, otherwise the path will be relative to the current working directory. You may include environment variables in the path surrounded by percent (%) symbols and they will be expanded.

If you have configured the server to permit clients to upload files, you must ensure that your application has permission to create files in the directory that you specify. A recommended location for the server root directory would be a subdirectory of the %ALLUSERSPROFILE% directory. Using the environment variable ensures that your server will work correctly on different versions of Windows. If the root directory does not exist at the time that the server is started, it will be created.

If the MultiUser property is False, all authenticated clients will have their current working directory initialized to the server root directory. If the MultiUser property is True, then users are assigned their own home directories and clients can access documents in those directories by including the username in the request URI.

This property can be read after the server has started and it will return the full path to the root directory. However, attempting to change the value of this property after the server has started will cause an exception to be raised. To change the root directory for the server, you must first call the Stop method which will terminate all active client connections.

Data Type

String

Example

' Set the server root directory
HttpServer1.Directory = "%ALLUSERSPROFILE%\MyProgram\WebServer"

See Also

MultiUser Property, AddUser Method