This is my first ASP.NET application and I'm having trouble passing a server side Bitmap object to the JavaScript client. I'm using SignalR to connect the server and client.
I've tried several things and hope this is easy for someone with ASP.NET experience.
Here is my server side C#:
public void ScreenShot()
{
Rectangle bounds = this.Bounds;
using (Image bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
}
Clients.Caller.updateImage(bitmap);
}
}
On the client side I want to get the Bitmap and display it:
hubproxy.client.updateImage = function (image) {
var img = document.createElement("img");
img.src = image;
document.body.appendChild(img);
};
Do I have to convert it to a JSON object? If I do this how do I get it back to an image on the client side?
Thanks in advance for helping.