Library - Webserver extension for Fez Cobra

[title]Webserver extension for Fez Cobra[/title]
http://code.tinyclr.com/project/243/webserver-extension-for-fez-cobra/
[line]
This HttpServer class uses Sockets listen for HTTP requests.
Version 2.0

You can handle requests in two ways:
– Link a C# callback method to a url. (The callback will be called when the clients browser requests the specified url). The callback method gets a Hashtable of GET variables and POST variables.
– Link a file on (flash-)disk to a url. (There is also a AddVirtualDirectory method that adds a complete directory, including all subdirectories to a virtual path on the WebServer).

Multipart form data

  • In latest version it is possible to use enctype=‘multipart/form-data’ in the HTML form tag, so you can upload files to the webserver.
  • When multipart is specified in the form, the event callback will receive HttpServer.MultiPartItem objects in the e.Post collection.
  • MultiPartItem object contains following properties:
  • Content (binary or string depending on ContentType)
  • ContentType (the type of the content or null when it was not specified)
  • Filename (the original filename of the uploaded file)

As from version 2.0, WebServer is now called HttpServer and has been splitted into multiple source files which are included in the FastloadMedia.NETMF library in attached archive. In addition to HttpServer, this library also contains a MD5Hash, SDCard, NetBIOS, StringBuilder, Json and SunTime class.

A .chm helpfile is included in the attached archive.

Additional note: since the HttpServer class now uses Sockets, it should be possible to use it on non EMX devices.