Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is no way to guarantee that a particular application will be opened when a user clicks a link / button on a web page. The application that is opened is determined by the user's browser and operating system settings.</p> <p>As a developer you can specify the <a href="http://en.wikipedia.org/wiki/MIME" rel="nofollow noreferrer">MIME type</a> of the file that you are returning. By doing so you are telling the user's browser what file type is contained in the response. W3Schools provides a pretty good <a href="http://www.w3schools.com/media/media_mimeref.asp" rel="nofollow noreferrer">MIME type by content type list</a> and <a href="http://filext.com/" rel="nofollow noreferrer">FILExt</a> also provides the MIME type for the files it lists.</p> <p>Assuming you specify the appropriate MIME content-type you can be sure the user's browser and operating system will open the file in the "appropriate" application according to their settings. Since you want to open a Word Document file the appropriate MIME content-type will be one of the following:</p> <p><pre> <strong>Extension Type/sub-type</strong> docx application/vnd.openxmlformats-officedocument.wordprocessingml.document doc application/msword </pre></p> <p>How and where you specify the content-type largely depends on the ASP.NET application type you are working with. If you are writing a ASP.NET Webforms application you'd change the MIME type of the Response object in the Page_Load method. In an ASP.NET MVC application you'd do so in a controller action. In either case the specific line of code is the same.</p> <pre><code>Response.ContentType = "application/msword"; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload