I am using asp.net mvc3. I am making a bitmap using text by system.drawing. I want
to send that image from my controller to my view in VIEWDATA, but in my view I cannot pars
If it doesn't need to be in the ViewData (not sure if you will be able to do it in the ViewData because each resource (image, flash, the page itself) has a ContentType that doesn't change in the current request.
However, you can try this in your controller:
public ActionResult GenerateImage() {
FileContentResult result;
using(var memStream = new System.IO.MemoryStream()) {
bitmap.Save(memStream, System.Drawing.Imaging.ImageFormat.Jpeg);
result = this.File(memStream.GetBuffer(), "image/jpeg");
}
return result;
}
In your view, you need to call the Controller/Action: