# WebResponse.File revelations

**URL:** <https://forum.xojo.com/t/webresponse-file-revelations/84902>\
**Category:** Web\
**Created:** [April 7, 2025, 12:54pm UTC](https://forum.xojo.com/t/webresponse-file-revelations/84902 "2025-04-07T12:54:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik\_Fohlin](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/8797f3/32.png) [@Erik\_Fohlin](https://forum.xojo.com/u/Erik_Fohlin)\
**Post date:** [April 7, 2025, 12:54pm UTC](https://forum.xojo.com/t/webresponse-file-revelations/84902/1 "2025-04-07T12:54:33Z")

</div>

I have been struggling with getting r`esponce.File` in `HandleURL` to work the way I want it to.  
By default it sets the Content-Disposition: html header to attachment; filename=“filename”

That header tells the browser to open a save dialog to save the file to disc, but I want to show the file (image) inline in the browser window instead.

Now, the documentation says that “Setting a header to a blank string removes the header.”  
When trying to do that by setting `response.Header("Content-Disposition") = ""` I realized that for some reason this does not work, the header is not removed.

This made me fall back to using `responce.Write(BinaryStream)` in HandleURL to deliver the file instead, which also works.  
Many others on here seems to be doing the same.

I finally got some time to create a bug for it, and make a little demo project showing the issue [78854](https://tracker.xojo.com/xojoinc/xojo/-/issues/78854)

With the demo project in place it was easy for me to also do a little benchmarking and comparison between delivering an image with `responce.File` and `responce.Write(BinaryStream)` through HandleURL

Wooha, it seems that `responce.File` is up to 22x faster than `responce.Write(BinaryStream)` running locally in debug mode on my Mac.

That is a big performance gain for my webapps so I decided to see if there was some other way to get rid of the annoying “Content-Disposition” header that was preventing me from using `responce.File` to deliver my images with HandleURL.

Turns out it is very very easy.  
All I had to do was set `response.Header("Content-Disposition") = "inline"` **after** setting the `responce.File`

At the end this gave me over 100% real life performance increase on my live webapps so Im happy, but I wish it would have been in the docs somewhere.

Just wanted to share this if there are others out there using `responce.Write(BinaryStream)` in `HandleURL` because you can not get `responce.File` to work for inline content.

---

<div class="post-metadata">

**Author:** ![Olivier\_Colard](https://forum.xojo.com/user_avatar/forum.xojo.com/olivier_colard/32/313_2.png) [@Olivier\_Colard](https://forum.xojo.com/u/Olivier_Colard)\
**Post date:** [April 7, 2025, 2:02pm UTC](https://forum.xojo.com/t/webresponse-file-revelations/84902/2 "2025-04-07T14:02:49Z")

</div>

Thanks for sharing.
