Snippet - FEZ Spider ethernet web server

[title]FEZ Spider ethernet web server[/title]
http://code.tinyclr.com/project/430/fez-spider-ethernet-web-server/
[line]
This is a simple demo usage of the ethernet module with the FEZ Spider Kit.
It creates a WebServer to receive orders from a browser to take pictures with a camera and display them.
It was greatly based on the project available at http://mikedodaro.net/2011/10/15/gadgeteer-web-service-surveillance-camera/ but I wasn’t able to make it work. It seems the API changed since that blog post, also this application is simpler.
I hope it is useful for other people learning their way with the network modules.

The Surveillance Camera Web Service example has been updated with API changes now. Sorry it took so long for me to notice.

Hello,

Is it possible to host images like .gif, .bmp and .jpeg??
I’ve tried before with other code, and it didn’t work.
It doesn’t work either with your code, my brower says: “The image http://192.168.1.102/image could not be shown because it contains errors”

This is the code I’m using to host the image:


if (_sdCardAdapter.IsCardMounted)
            {
                StorageDevice storage = _sdCardAdapter.GetStorageDevice();

                using (FileStream stream = storage.OpenRead(@ "\system_Webserver\quotes.gif"))
                {
                    try
                    {
                        byte[] bytes = new byte[stream.Length];
                        stream.Read(bytes, 0, (int)stream.Length);
                        responder.Respond(new Picture(bytes, Picture.PictureEncoding.GIF));
                    }
                    catch (Exception ex)
                    {
                        responder.Respond("Exception: " + ex.Message + "  Inner Exception: " + ex.InnerException);
                    }
                }

And this doesn’t works either:


responder.Respond(bytes, "image/jpeg");

Try this:


responder.Respond(bytes, "image/gif");