Click here to Skip to main content
15,741,892 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am developing ASP.net web application using C# and MVC. I am trying to open word document using locally installed ms word application.

What I have tried:

tryied using microsoft.office.interop.word
Posted
Updated 31-Dec-19 23:09pm

You can't.
Any application you open via C# will be running on the Server, because that is where your C# code executes. As a result - just like MessageBox - it's not visible to the CLient at all. (It may appear to work in dev, because the Client and the Server are both executing on the same machine, but it will fail completely in production). In addition, most web servers do not have any work of "user software" installed and that includes Office.

You cannot open any application on the client directly from the server (or from the browser) for security reasons. Think about it: if your site could open an app on your computer, so could malicious sites - and then the ransomware problem would be a whole load worse than it is.
 
Share this answer
 
v2
See the answers here: Can I Open Word Document In Browser Or Calling Ms Word Application Using Html 5 ..?[^]

Note that you can not open a file that is hard coded as a string, but it is possible to display a filedialog in the browser and let the user decide to open a file or not.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900