user34537
user34537

Reputation:

Why are image acting as downloads?

I am using C# ASP.NET. I generate user friendly image names and use rewrite to find the correct image name. Normally in firefox when i right click an image and hit view image i get the image in my browser. However these images are acting like downloads, why?

global.asax:
    void Application_BeginRequest(Object sender, EventArgs e)
    {
        lazy(Context, HttpContext.Current.Request);
    }
file.cs:
    void lazy(...)
    {
        ...
        context.RewritePath(sz);
        //sz = "/user/username/type/image.png"
    }

Upvotes: 0

Views: 156

Answers (2)

adrianbanks
adrianbanks

Reputation: 82944

The mime-type of the image is probably being reset by the RewritePath call. If so, FireFox then thinks that the image is just a binary stream and doesn't know what to do with it so it just attempts to download it.

Upvotes: 0

statenjason
statenjason

Reputation: 5180

Likely because the correct MIME type is not being sent along with the image.

Upvotes: 2

Related Questions