I need to provide a process for people in a tightly controlled corporate Windows environment, who can't access PowerShell or install wget-like software, to download very large XML files from web server interfaces that, by default, try to display 50mb+ XML files in the browser. This would crash their browsers.

How can these files be downloaded as files, instead of displayed as a page?

They have common Windows software like MS Office and common web browsers, and have Notepad++. The files will be processed through other (upload only) services to make them more managable sizes before being used in anything like Notepad++ directly, which will also struggle with the raw files.

  • If you're downloading from a link, right click on the link, and choose "save link as". – Adrien Jul 25 '16 at 11:46
  • No, it's not that easy unfortunately, it's a webserver where we have to build a URL based on parameters. One option I did consider though was creating a HTML file that contains a link so that people could use that... – user56reinstatemonica8 Jul 25 '16 at 11:51
  • Do you have any control over the web server ? If so, you could get it to serve with a different content-type (e.g. application/octet-stream) so that the browser pops a save as dialog – Adrien Jul 25 '16 at 11:58
  • Nope, it's a 3rd party service. It's also hard to research this topic because 90% of the results that come up on searches are about how to control it from the server side with mime-types etc... – user56reinstatemonica8 Jul 25 '16 at 11:59
  • OK, one final option... if you can retrieve it via a proxy, you can rewrite the Content-Type header as it comes in. Our product WinGate will allow you to do this, and I think some others can rewrite headers as well. Disclaimer, I work for Qbik who are the authors of WinGate. – Adrien Jul 25 '16 at 12:10

I found a trick using the fact Google Chrome reloads pages when it tries to save them.

  • Open the links to the massive amounts of text as normal Chrome urls
  • Wait until code starts appearing on the screen, then hit the browser 'Stop' button
  • Right-click. "Save as" is now available. This reloads the incomplete page, using download functionality from the start, instead of trying to display it in the browser

Another option I considered as a last resort was simply creating a HTML file that contains nothing but a link to the page, that they could right-click and save from. They might however be subject to security restrictions on following a link from an offline HTML file.

    <title>Right-click the link</title>
    <style> a { display: block; height: 200px; width: 200px; margin: 30px; padding: 80px 0px; text-align: center; font-size: 2em; background: #eeeeee; } </style>
<a href="url-here.com">Right click and save this link</a>

Browsers choose how to process a downloaded resource based on the Content-Type of the resource, as identified in the http response that carried it (browsers also commonly inspect the content to figure out what it is, if there is no Content-Type field in the response).

So it is possible to get a browser to prompt to save any downloaded resource if you can change the Content-Type of the response. A Content-Type that you can rely on causing a resource to be saved as a file is the type "application/octet-stream".

You can change the Content-Type response header of http responses using a proxy server. Several proxy servers can rewrite headers. Our product WinGate provides the ability to modify response headers before the response is sent to the client. It is also free for 10 concurrent users, so may be free in your situation.


  1. Firstly, you'd need to install the proxy, and set the clients to use it. If you already have a corporate proxy, you may need to configure WinGate's WWW proxy to connect out via that proxy.

  2. Secondly, the configuration to rewrite the header. WinGate has a flow-chart GUI policy system, which you drag-drop elements onto in order to process events.

The event you want to process is the ProxyResponse event for your WWW proxy. In WinGate Management, you'd navigate to WinGate > Control Panel > Policy and click on the task "New Policy". Choose Source Type: Any HTTPProxy and Event Type: ProxyResponse and give it a name.

New Policy

Clicking OK will open up the policy editor. Drag the event (e.g. WWW Proxy Server: ProxyResponse) onto the worksheet at the top left, then drag a List Lookup Check onto the worksheet, it will pop an edit dialog, click the funny S button at the top left, and it will look like this, drill down to Request.URL and hit OK

Add list and select value to match

Select "pattern match" for the matching method, and add a new value with the match spec for the URLs you want to alter the Content-Type for, with a wild-card if you need to match a URL with different query strings.

enter image description here

click ok, give it a name, then connect this item to the Event, by dragging from the RHS of the event onto the item.

Then drag an Expression evaluator item onto the worksheet. Enter the value Response.Headers.Set("Content-Type","application/octet-stream"), uncheck "resolve expresson into true/false..."

Expression evaluator - Change Content type

Then connect this to the Yes output of the List check item. Click the Save button at the top, and it's live.

Your policy will look something like this.

Finished policy

Now when someone requests a URL that matches your matching value in the Check URL item, it will save it as a file.

Disclaimer: I work for Qbik who are the authors of WinGate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.