2008-11-05 6 views

Répondre

0

Vous pouvez aussi le faire vous-même assez simplement avec une action de contrôleur:

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(); 
    } 
} 
Questions connexes