Stop Excel from opening in a browser window (IE)

Posted on 2006-06-07
Last Modified: 2011-10-03
Here's the deal.  I have say, 500 given Excel documents stored in the file system of an IIS web server.  I have a page that reads in those file names from the directory and displays an HTML link to them.  

Question:  How do I make that file open in Excel, and not in the browser when they click the link (I've seen this done before so I know it's possible)?  Is there an IIS setting I can choose that would change the MIME type for certain files as they're sent?  I can't change the content-type because I'm not actually creating the content, it's already a file.  I could read it in with the FileScriptingObject but that's not a preferred method.  Thoughts?
Question by:IUFITS
    LVL 15

    Accepted Solution

    I prefer to use ado to do a binary write and send "attachment" in a content-disposition header...
    LVL 35

    Expert Comment

    >>I've seen this done before so I know it's possible
    Actually it depends on the browser.  You can't control how it opens.  You can force them to save the file instead of opening, but then they have to double click to open (joeposter's link shows how to do that).

    But you cannot control the user's browser as to if it opens in excel or the browser excel plug-in
    LVL 7

    Expert Comment

    I just want to reaffirm mrichmon's comment... I have my browser to open Excel (and Word, Acrobat, etc) every time.  I don't like my browser overshadowing the application.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    When pages do not download correctly, and you don't know why, the first thing you do is to look at the HTML source code of that page, but not all the downloaded files appear always clearly. If your source includes a javascript that computes the name…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now