Implementing a handler

In order to implement a handler you should inherit from the RequestHandler abstract base class and implement the Process method.

The FilePath parameter of the Process method contains the full path to the local file onto which the request URL was mapped (regardless of whether or not it exists), or null if the request URL was not mapped onto a local file (for example if LocalRoot is null, or the request URL was not rooted under the RootUrl property of the web server).

Your handler implementation should close the response stream before execution completes (this will not be done by the web server).

As an implementor of RequestHandler you have access to the following protected properties methods:

LocalRoot

The string property LocalRoot contains the full path to the local root directory onto which requests are mapped.

RootUrl

The string property RootUrl contains the root URL for the web server.

Initialise

The virtual method initialise is called as the server starts up, before any requests are forwarded to the handler. You should make sure to call the base initialise method in order to ensure that the LocalRoot and RootUrl properties are set.

Last edited Aug 3, 2010 at 11:50 AM by Kragen2uk, version 4

Comments

No comments yet.