public ActionResult Overview(int subId, string countrycod)
{
byte[] objByteArray =(byte[]) objResponse.Data;
//return View();
System.IO.MemoryStream imagestream = new System.IO.MemoryStream();
imagestream.Write(objByteArray, 0, objByteArray.Length);
//return new FileStreamResult(new System.IO.MemoryStream(objByteArray,true),"image/png");
return new FileStreamResult(imagestream, "image/png");
}
2112 次
1 に答える
3
メモリ ストリームは必要ありません。バイト配列を直接返すことができます。
public ActionResult Overview(int subId, string countrycod)
{
byte[] objByteArray = (byte[])objResponse.Data;
return File(objByteArray, "image/png");
}
次に、ビュー内で、コントローラー アクション<img>
を指すタグを使用します。Overview
かみそり:
<img src="@Url.Action("Overview", "SomeController", new { subId = 123, countrycod = "en-US" })" />
ウェブフォーム:
かみそり:
<img src="<%= Url.Action("Overview", "SomeController", new { subId = 123, countrycod = "en-US" }) %>" />
于 2012-07-10T05:54:38.317 に答える