Skip to content

Instantly share code, notes, and snippets.

@jz5
Last active August 29, 2015 14:16
Show Gist options
  • Save jz5/6854282a2a6a1ba476d3 to your computer and use it in GitHub Desktop.
Save jz5/6854282a2a6a1ba476d3 to your computer and use it in GitHub Desktop.
Function Image() As ActionResult
Dim path = Server.MapPath("~/App_Data/images/")
Dim bmp = New Bitmap(IO.Path.Combine(path, "sample.png"))
Dim ms = New MemoryStream()
bmp.Save(ms, Imaging.ImageFormat.Png)
bmp.Dispose()
ms.Position = 0
Return New FileStreamResult(ms, "image/png")
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment