Automatically download a document when the page loads
I had a requirement to start a download of a file automatically once my custom application page loads. After trying a couple of approaches, I found this approach which works consistently across browsers. It also turns out to only be a few lines of code. I’ve refactored it into the method below.