Click or drag to resize
HttpCwsServer Class
The Crestron Web Scripting server class
Inheritance Hierarchy
SystemObject
  Crestron.SimplSharp.WebScriptingHttpCwsServer

Namespace: Crestron.SimplSharp.WebScripting
Assembly: SimplSharpCWSHelperInterface (in SimplSharpCWSHelperInterface.dll)
Syntax
C#
public sealed class HttpCwsServer : IDisposable

The HttpCwsServer type exposes the following members.

Constructors
  NameDescription
Public methodHttpCwsServer
Initializes a Http Server instance and registers the virtual URL path with the IIS server
Top
Properties
  NameDescription
Public propertyCode exampleHttpRequestHandler
Gets or sets the object that processes requests.
Public propertyCode exampleRoutes
Gets a collection of objects that derive from the HttpCwsRoute class
Top
Methods
  NameDescription
Public methodAddRoute
Adds a route to the end of the HttpCwsRouteCollection.
Public methodCode exampleDispose
Unregisters the URL path with IIS server and cleans up the server object's resources
Protected methodFinalize
The finalizer
(Overrides ObjectFinalize.)
Public methodHtmlDecode(String)
Decodes an HTML-encoded string and returns the decoded string.
Public methodHtmlDecode(String, TextWriter)
Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
Public methodHtmlEncode(String)
HTML-encodes a string and returns the encoded string.
Public methodHtmlEncode(String, TextWriter)
HTML-encodes a string and sends the resulting output to a TextWriter output stream.
Public methodRegister
Registers the URL path provided in the constructor with the CWS framework.
Public methodRemoveRoute
Removes the first occurrence of a specific route from the HttpCwsRouteCollection.
Public methodUnregister
Unregisters the URL path provided in the constructor with the CWS framework.
Public methodUrlDecode(String)
URL-decodes a string and returns the decoded string.
Public methodUrlDecode(String, TextWriter)
Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.
Public methodUrlDecode(String, Encoding)
URL-decodes a string and returns the decoded string.
Public methodUrlDecode(String, TextWriter, Encoding)
Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.
Public methodUrlEncode(String)
URL-encodes a string and returns the encoded string.
Public methodUrlEncode(String, TextWriter)
URL-encodes a string and sends the resulting output to a TextWriter output stream.
Public methodUrlEncode(String, Encoding)
URL-encodes a string and returns the encoded string.
Public methodUrlEncode(String, TextWriter, Encoding)
URL-encodes a string and sends the resulting output to a TextWriter output stream.
Top
Events
  NameDescription
Public eventReceivedRequestEvent
Occurs when incoming Http request is ready to be processed and responded.
Top
Examples
//Create server with "/api" virtual path
//The base URL will look like http://your-host-name-or-ip/cws/api
cwsServ = new HttpCwsServer("/API");
//Do something light on the event. Do not process the requests in the event handler.
cwsServ.ReceivedRequestEvent += new HttpCwsRequestEventHandler(cwsServ_ReceivedRequestEvent);
cwsServ.HttpRequestHandler = new _cwsServ_Handler(); //Default Handler to process an unrouted or unsolicited request
See Also