IWebServer Interface |
Namespace: VirtualRadar.Interface.WebServer
The IWebServer type exposes the following members.
Name | Description | |
---|---|---|
AuthenticationScheme |
Gets or sets the authentication scheme to use.
| |
CacheCredentials |
Gets or sets a value indicating that authentication credentials can be cached by the server.
| |
ExternalAddress |
Gets the address of the web server on the public Internet (e.g. http://12.13.14.15:8080/Root).
| |
ExternalIPAddress |
Gets or sets the IP address of the local machine on the public internet. Optional, used to build ExternalAddress.
| |
ExternalPort |
Gets or sets the port number that public Internet clients can connect to in order to reach this machine. Optional, used to
build ExternalAddress.
| |
LocalAddress |
Gets the local address of the web server (e.g. http://127.0.0.1:8090/Root).
| |
NetworkAddress |
Gets the address of the web server on the LAN (e.g. http://192.168.0.1:8090/Root).
| |
NetworkIPAddress |
Gets the IP address of the current machine on the LAN (e.g. 192.168.0.1).
| |
Online |
Gets or sets a value indicating that the server is online.
| |
Port |
Gets or sets the port number to listen to.
| |
PortText |
Gets the Port number as a string suitable for use in a URL.
| |
Prefix |
Gets the prefix that describes the combination of root and port.
| |
Provider |
Gets or sets the provider used to wrap bits of the .NET framework.
| |
Root |
Gets or sets the root of the web site that the server will listen to.
|
Name | Description | |
---|---|---|
AddAdministratorPath |
Tells the server that all access to this path must be authenticated and that the user must be configured as
an administrator.
| |
Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.) | |
GetAdministratorPaths |
Returns the paths that have been marked as requiring authentication.
| |
GetRestrictedPathsMap |
Returns a map of restricted paths to the Access describing which IPAddresses can access the path.
| |
RemoveAdministratorPath |
Tells the server that anyone can now access this path.
| |
ResetCredentialCache |
Clears the cache of credentials held by the server - see CacheCredentials.
| |
SetRestrictedPath |
Sets access on a restricted path. If access is null then the restrictions are removed
from the path.
|
Name | Description | |
---|---|---|
AfterRequestReceived |
Raised on a background thread when the web server receives a request from a browser. Called
after RequestReceived is raised.
| |
AuthenticationRequired |
Raised when the AuthenticationScheme is not 'None' and the browser has supplied credentials that need testing.
| |
BeforeRequestReceived |
Raised on a background thread when the web server receives a request from a browser. Called
before RequestReceived is raised.
| |
ExceptionCaught |
Raised when an exception is caught on the background thread. The background thread should not
pass ThreadAbortException through this.
(Inherited from IBackgroundThreadExceptionCatcher.) | |
ExternalAddressChanged |
Raised when the ExternalAddress property changes.
| |
OnlineChanged |
Raised when the Online property changes state.
| |
RequestFinished |
Raised after a response has been sent and the request completely closed down. The parameter is
the UniqueId of the ResponseSentEventArgs original created for the request.
| |
RequestReceived |
Raised on a background thread when the web server receives a request from a browser.
| |
ResponseSent |
Raised on a background thread when the web server responds to a request.
|
Once the properties have been set the server is controlled through the Online property. Setting it to true starts the server, setting it to false takes it offline.
When a request is received from a browser the RequestReceived event is raised. This is passed a RequestReceivedEventArgs object. If the handler(s) do not set the Handled property of the args then the server responds with a "Content not found" error, otherwise the content as described by Response property is sent to the browser.
The web server supports authentication. When authentication is required the AuthenticationScheme property should be set to a value that is not Anonymous. The server will raise AuthenticationRequired and pass an AuthenticationRequiredEventArgs. Setting the IsAuthenticated property will allow the request to proceed. The CacheCredentials property can be used to prevent the event being raised for credentials that the server has previously seen, and which were previously confirmed to be good by an event handler.
If the implementation of IWebServer is using the .NET Framework HttpListener then be aware that this will not run without admin privileges under Windows 7 or Vista, unless you first run a NETSH command to give the application permission to listen to a particular root and port. The installer for Virtual Radar Server sets this permission up so that Virtual Radar Server can remain at normal user permissions, if you use the server for your own applications you may need to do the same or ask the user to run your application as an administrator. It is not guaranteed, however, that the implementation is using HttpListener.