This my API..
- [HttpGet]
- public IActionResult Get()
- {
- Byte[] b = System.IO.File.ReadAllBytes(@"E:\\Test.jpg");
- // You can use your own method over here.
- return File(b, "image/jpeg");
- }
i m getting responce as File,, I am reading this responce as
var responce = request.Content.ReadAsByteArrayAsync().Result;
i want ot create Object url for this in mvc controller and wanted to set objUrl to src of image tag in View


Viswanatha SwamyRank #43 · 33.4K reputationPosted Mar 1, 2020, 5:48 PM EST
Joginder BangerRank #360 · 7K reputationPosted Mar 1, 2020, 6:24 PM EST
Dileep Singh39 reputationPosted Mar 2, 2020, 4:23 PM EST
Laxmidhar SahooRank #383 · 6.6K reputationPosted Mar 2, 2020, 6:18 PM EST
public IActionResult Get()
{
Byte[] b = System.IO.File.ReadAllBytes(@"E:\\Test.jpg");
// You can convert to string using method Convert.ToBase64String from byte array.
string result = Convert.ToBase64String(b,0,b.length);
//return File(b, "image/jpeg");
return result;
}
https://jsfiddle.net/yasumodev/tg298ns7/