Gets and sets the current URL used to access a file on the server.
A string which specifies the current URL.
The URL property returns the current Uniform Resource Locator string which is used by the control to access a file on the server. URLs have a specific format which provides information about the remote host, port, path and file name, as well as optional information such as a username and password for authentication:
ftp://[username : [password] @] remotehost [:remoteport] / [path/...] filename [;type=id]
The first part of the URL is the protocol and in this case will always be "ftp", or "ftps" if a secure connection is being used. If a username and password is required for authentication, then this will be included in the URL before the name of the remote host; otherwise an anonymous FTP session is assumed. Next, there is the name of the remote host to connect to, optionally followed by a port number. If no port number is given, then the default port for the protocol will be used. This is followed by the path, and then the name of the file on the server. An optional file type may be specified as well, with the type identifier being either "a" for text files or "i" for binary files.
One important consideration when using FTP URLs is that the path is relative to the user's home directory and should not be considered an absolute path from the root directory on the server. If no username and password is provided, then an anonymous session is used and the path is relative to the public directory used by the FTP server.
Here are some typical examples of URLs used to access files on an FTP server:
ftp://www.bigcorp.com/pub/financial/jan2004.xls
In this example, the remote host is www.bigcorp.com, the path is "pub/financial" and the file name is "jan2004.xls". The default port will be used to access the file, and no username and password is provided for authentication so this file must be publically available to anonymous users.
ftp://www.bigcorp.com:2121/employees/picnic.doc
In this example, the remote host is www.bigcorp.com, the path is "employees" and the file name is "picnic.doc". However, the client should connect to an alternative port number, in this case 2121. This file must also be available to anonymous users because no username or password has been specified.
ftps://executive:secret@www.bigcorp.com/corporate/projections/sales2010.xls
In this example, the remote host is www.bigcorp.com and, the path is "corporate/projections" and the file name is "sales2010.xls". Because the protocol is ftps, a secure connection on port 990 will be established. The user name "executive" and password "secret" will be used to authenticate the session.
When setting the URL property, the class will parse the string and automatically update the HostName, RemotePort, UserName, Password, RemotePath and RemoteFile properties according to the values specified in the URL. This enables an application to simply provide the URL and then call the Connect method to establish the connection.
Note that if this property is assigned a value which cannot be parsed, an exception will be thrown that indicates that the property value is invalid. If the user enters an invalid URL and there is no exception handler, the unhandled exception will terminate the application.