I've got a view which consists of a customers id as well as an image column.

This is what i have attempted doing to retrieve the look however i keep obtaining a box by having an red-colored x rather than the particular image.

View

<td><img src="<%= Url.Action( "DisplayImage" , "User" , new { id = item.id} ) %>" alt="" /></td>

Controller

  public FileContentResult DisplayImage(string id)
    {
        byte[] image = repository.GetImage(id);
        return File(image, "image/jpg");
    }

i have also attempted coming back an ActionResult rather which did not work either.

Repository

    public Byte[] GetImage(string id)
    {

        var image = db.GetImage(id).First<GetImageResult>();

        if (image == null)
            return null;
        return image.UserImage;
    }

LinqTOSQL Class

    [Function(Name="dbo.GetImage")]
public ISingleResult<GetImageResult> GetImage([Parameter(DbType="VarChar(8)")] string id)
{
	IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), id);
	return ((ISingleResult<GetImageResult>)(result.ReturnValue));
}

public partial class GetImageResult
{
	private System.Byte[] _userImage;

	public GetImageResult()
	{
	}


	[Column(Storage="_userImage", DbType="Image")]
	public System.Byte[] UserImage
	{
		get
		{
			return this._userImage;
		}
		set
		{
			if ((this. _userImage!= value))
			{
				this. _userImage = value;
			}
		}
	}
}

I have been killing myself all day long looking to get this to operate, however it just is not working. The return type around the saved procedure is definitely an integer (atleast after i take a look at parameters in SQL Server Management Studio it states integer), however i can't redefine that can now i?

It's really striking the DisplayImage Action using the correct parameters inside the UserController and coming back File(imageByteArray, "image/digital") only a box with red-colored x has been displayed. Any help could be greatly appreciated.

edit: I have attempted debugging with the addition of a Reponse.BinaryWrite(imageByteArray) inside the action result and striking the url directly by goign to http://localhost/User/DisplayImage?id=10101010 and also the image for your user is displayed in mspaint.

edit2: I additionally did a view source and my html for your image tag arrived on the scene as following.

<td>
    <img src='/User.mvc/GetImage?id=U00915441' alt="" />
</td>

Thanks