/// <summary> /// Get stream as a Base64 string data. /// </summary> /// <returns>Base64 string format of image.</returns> public string GetBase64() { var stream = new MemoryStream(); ImageStream.CopyTo(stream); stream.Seek(0, SeekOrigin.Begin); return(Convert.ToBase64String(stream.ToArray())); }
public override void ExecuteResult(ControllerContext context) { if (context == null) { throw new ArgumentNullException("context"); } HttpResponseBase response = context.HttpContext.Response; response.ContentType = ContentType; ImageStream.CopyTo(response.OutputStream); response.End(); }