Version: 1.9.4.0
Construct web applications with an internal listener (no IIS dependency!).

WebServer ActiveX Control (HTTP, HTTPS)

Use the WebServer control to turn any application into a custom HTTP Web Server. Build Web Applications in a familiar software environment. Features include:

  • Allows you to create a server side web application without having to learn ASP, Cold Fusion or other web application development environment.
  • Give a web interface to any stand-alone application.
  • Compatible with MS SOAP library (create a SOAP server).
  • Supports HTTPS.

 

Development Environments

  • Visual Studio .NET (.NET Framework)
  • Visual Basic (VB)
  • Visual C++ (VC++)
  • FoxPro
  • PowerBuilder
  • Delphi
  • C++ Builder
  • Office 97/2000

Interface

 

Public Constructors
WebServer Build web-based applications from within Visual Basic or any other development environment that supports ActiveX controls.
Public Properties
Certificate Certificate Object to use when authenticating to the remote host.
ClientAuthentication Applies to server operation only.
Count Number of nonsecure TCP connections currently open.
DefaultFiles Collection of default filenames.
LocalAddress Returns the address in use while the Daemon is active and an empty string when the Daemon socket is closed.
LocalPort Returns the port number in use while the Daemon is active and 0 when the Daemon is closed.
LocalSecureAddress Returns the local host address being used for accepting secure connections. The format is dot notation (for example, nnn.nnn.nnn.nnn). A non-empty value indicates the WebServer Control is accepting secure HTTP requests.
LocalSecurePort Returns the port number being used for accepting secure connections. A non-zero value indicates the WebServer Control is accepting secure HTTP requests.
LogDirectory Directory for daily log files. The default value is an empty string.
MaxIdleTime Amount of time a session can remain idle before expiring.
MaxMemBuffer Maximum number of memory bytes used when receiving the body of a request.
PlaceCookies Controls whether cookies are sent. Only affects the automatic Dart Cookies.
Protocol Specifies the security protocol used.
PutLength Controls whether the Content-Length is inserted in the header.
RootDirectory Root directory for web pages.
SecureCount Number of secure connections currently open.
Sessions Collection of active Session Objects.
UseTemp Gets or sets whether or not to place uploaded files in the temp directory.
Public Methods
About Show the About Box.
Pause Stop the server from accepting new connections, while allowing established connections and sessions to persist.
Start Start processing HTTP/HTTPS requests.
Stop Stop the server from accepting new connections and immediately close existing client connections.
Trace Start or stop the accumulation of trace or debug data. Once started, this method accumulates data until it is turned off.
Public Events
Authenticate Fires when the remote host has sent a certificate to be authenticated.
Error Fires whenever an error condition occurs.
Get Fires when a GET request is received. By default, file information and content is sent back to the client. Place code within this event to modify the default response.
Head Fires when a HEAD request is received. By default, header information is sent back to the client. Place code within this event to modify the default response.
Post Fires when a POST request is received. By default, a status of "Forbidden" is returned. Place code within this event to modify the default response.
Put Fires when a PUT request is received. By default, a status of "Forbidden" is returned. Place code within this event to modify the default response.
Request Fires when an unknown request is received.
SessionEnd Fires before a session is destroyed.
SessionInit Fires after a new session is created.

Code Example

How easy is the WebServer control to use? Check out the following VB example below, which demonstrates "starting" a webserver, then responding to an HTTP GET request (which causes the WebServer component's Get event to fire).

Private Sub Command1_Click()
   On Error GoTo OnError ' use intrinsic error handling
   
   ' Start a non-secure server on port 8080
   WebServer1.Start 8080, -1
   Exit Sub

OnError: ' Any error jumps here
   Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub


Private Sub WebServer1_Get(ByVal Session As DartWebServerCtl.ISession,_
                           ByVal Request As DartWebServerCtl.IRequest,_
                           ByVal Response As DartWebServerCtl.IResponse)
   On Error GoTo OnError ' use intrinsic error handling
   
   Response.Header(httpServer) = "My Web Server/1.0"
   ' Add other headers here.

   If Response.Status = httpOK Then
      ' found template page...
   Else
      ' page not found: return default error page
   End If
   Exit Sub
OnError: ' Any error jumps here
   Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub