asp.net ashx handler prompting download instead of displaying file

后端 未结 3 1175
逝去的感伤
逝去的感伤 2021-01-20 22:11

I implemented a generic handler in my application which works great for images, but when I manually type the handler URL in the browser with the image\'s querystring it prom

3条回答
  •  鱼传尺愫
    2021-01-20 22:46

    If you store the ContentType as part of the files metadata, when you pull it back down your could use it.

    theFile = GetFile(id)
    context.Response.ContentType = theFile.Type;
    

提交回复
热议问题