It is not possible to guarantee that a particular application will be open when a user clicks a link / button on a web page. The application you are opening is determined by your browser and operating system settings.
As a developer, you can specify the MIME type of the file you are returning. By doing so, you tell the user what type of file the response contains. W3Schools provides a pretty good MIME type for the content list type, and FILExt also provides a MIME type for the files it lists.
Assuming that you specify the appropriate type of MIME content, you can be sure that 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 corresponding MIME content type will be one of the following:
Extension Type / sub-type
docx application / vnd.openxmlformats-officedocument.wordprocessingml.document
doc application / msword
How and where to specify the type of content depends largely on the type of ASP.NET application you are working with. If you are writing an ASP.NET Webforms application, you must change the MIME type of the Response object in the Page_Load method. In an ASP.NET MVC application, you do this in a controller action. In any case, the specific line of code is the same.
Response.ContentType = "application/msword";
source share