Created
March 13, 2018 10:15
-
-
Save LinZap/f607f5d7602309e7e7483b6d06d635f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImageController : ApiController | |
{ | |
[HttpGet] | |
public HttpResponseMessage getImg() { | |
string ImgPath = @"D:\CSharp\MyWebAPI\MyWebAPI\App_Data\123.jpg"; | |
var resp = new HttpResponseMessage(); | |
resp.Content = new StreamContent(File.OpenRead(ImgPath)); | |
resp.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg"); | |
return resp; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment