extend web server to serve static files
- by Turtle
Hello, I want to extend a web server which is only able to handle RPC handling now. The web server is written in C#. It provides a abstract handler function like following:
public string owsHandler(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
And I wrote following code to handle image files:
Bitmap queryImg = new Bitmap(path);
System.IO.MemoryStream stream = new System.IO.MemoryStream();
queryImg.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
queryImg.Dispose();
byte[] byteImage = stream.ToArray();
stream.Dispose();
return Convert.ToBase64String(byteImage);
And I test it in the browser, the image is returned but the image dimension info is missed. Shall I add something more to the code? Or is any general way to server static files? I do not want to serve it in a ASP.net server.
Thanks