RequestController Class

HttpServer.dll

A controller in the Model-View-Controller pattern. Derive this class and add method with one of the following signatures: "public string MethodName()" or "public void MyMethod()". The first should return a string with the response, the latter should use SendHeader and SendBody methods to handle the response.

Namespace:  HttpServer.Controllers
Assembly:  HttpServer (in HttpServer.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public abstract class RequestController : HttpModule, 
	ICloneable
Visual Basic (Declaration)
Public MustInherit Class RequestController _
	Inherits HttpModule _
	Implements ICloneable
Visual C++
public ref class RequestController abstract : public HttpModule, 
	ICloneable

Remarks

Last segment of the path is always broken into the properties Id and RequestedType Alhtough note that the RequestedType can also be empty if no file extension have been specified. A typical use of file extensions in controllers is to specify which type of format to return.

Examples

public class MyController : RequestController { public string Hello() { if (RequestedType == "xml") return "<hello>World<hello>"; else return "Hello " + Request.QueryString["user"].Value + ", welcome to my world"; } public void File() { Response.Headers.ContentType = "text/xml"; Response.SendHeader(); } }

Inheritance Hierarchy

System..::.Object
  HttpServer.HttpModules..::.HttpModule
    HttpServer.Controllers..::.RequestController
      HttpServer.Controllers..::.ViewController

See Also