asp.netexcelhttpmicrosoft-edgeattachment

Is there a way to force MS Edge to open an Excel file within itself rather than download it?


In my organization, which uses MS Edge as its default browser, there is a regularly updated and frequently opened Excel spreadsheet which we host on an internal IIS server and to which we link from a different internal ASP.NET website, also on IIS. Every time someone clicks the link, the file gets downloaded again and has to be manually opened in the user's desktop copy of Excel even though it's possible for Edge to view MS Office files now (through the Office web app) and this setting is on by default. Whether or not this "Open Office files in the browser" option in Edge is enabled has no bearing on what happens. Dragging and dropping, or Ctrl+O-ing the downloaded file just makes Edge "download" it again.

My questions here:

As a last resort, we could instead store the document as a PDF (it is essentially read-only).

Tried:

Everyone is signed into Office 365 with their Microsoft account, which I've also seen mentioned as a requirement.

Expectations:

Reality:


Solution

  • "Open Office files in the browser" this feature works for public reachable Office documents under the below limitations. You can refer to this article and check if your Excel file meets the requirements:

    The OpenInOfficeViewerIfApplicable feature watches navigations to detect when Office-related file extensions (.xls, .docx, pptx, etc) or Content-Types (application/msword, application/vnd.ms-excel, etc) are observed, indicating that a navigation led directly to an Office document that would otherwise be deemed as having a non-webby MIME type and thus normally be converted into a download.

    The feature is bypassed if:

    1. The Open Office files in the browser checkbox is turned off in edge://settings
    2. The response contains a Content-Disposition:attachment header
    3. The request contains an Authorization or Proxy-Authorization header
    4. The user initiated the download from the “Save As” item on the browser’s context menu
    5. The referring URL is on a limited set of exempted domains (Office, SharePoint, OneDrive, Blackboard, etc)
    6. The request method is not GET
    7. The file size is not known (e.g. Transfer-Encoding: chunked)
    8. The file size is over 100mb
    9. The browser is running in Incognito mode
    10. The file was served from an IP address that is not publicly routable