Fredrick Lackey - 71 - Aug 17, 2014

What’s the best way to serve an image from ServiceStack when the file does not have an extension and is not recorded anywhere while ensuring all common browsers (including IE) display the image inline?  The HelloImage examples seem to default to PNG which concerns me that there would be a mismatch.  They also cause Chrome and IE to behave differently (Chrome displays inline / IE prompts to download).

Geoffrey Huntley:

Override the Response.ContentType manually and return a HttpResult:

public object Get(GetEmployeeAvatar request)
    var photo = EmployeePhoto.GetEmployeeThumbnailPhoto(new MailAddress(request.EmployeeEmailAddress));

    const string contentType = “image/png”;
    base.Response.ContentType = contentType;
    return new HttpResult(photo, contentType);

Darren Reid:

I think Internet Explorer is tied to the systems registry, where as Chrome might handle some of the known content types itself, not sure. On my PC, image/png in the example services works fine on IE. Content type of image/jpg works on Chrome, but not IE as my machine has *.jpg registered with content type image/jpeg, not image/jpg. Have a look in “HKEY_CLASSES_ROOT.png\Content Type” in the registry to see what value is being used.

Some one having a similar issue here ->

Example services I used for testing.

I’ve just added several different examples of return an Image in ServiceStack in different image formats:

I’ve tested a lot ofthe different combinations with IE and I’m not seeing any issues with it.

You can play with these services at:, e.g: