2008-11-05 4 views

답변

0

또한 컨트롤러 액션 꽤 간단하게 자신이 작업을 수행 할 수 있습니다

public void RenderImage(int imageId) 
{ 
    // TODO: Replace this with your API to get the image blob data. 
    byte[] data = this.repo.GetImageData(imageId); 

    if (data != null) 
    { 
     // This assumes you're storing JPEG data 
     Response.ContentType = "image/jpeg"; 
     Response.Expires = 0; 
     Response.Buffer = true; 
     Response.Clear(); 
     Response.BinaryWrite(data); 
    } 
    else 
    { 
     this.ControllerContext.HttpContext.ApplicationInstance.CompleteRequest(); 
    } 
}