I have a Microsoft Word document that I would like to link to in my site. The document is actually hosted on another server (Internal SharePoint site). I would like it if when the user clicks the link that it opens the document in their browser by default. If not possible then it will prompt them for download.
Is this possible for me to control or is it only something each individual user has to set up on their machines?
If the user can access the Sharepoint site, you can just link to download link of the document on the Sharepoint site?
If the user cannot acces the Sharepoint site, you could stream it yourself, but that's hardly recommended.
Why can't you just link to the download link of the document?
You specifically want to know how to make sure the link opens directly. For this you need to change the MIME type of the Response (the download) to provide more info to the browser how it can open that link. More info in this answer: https://stackoverflow.com/a/2806749/65087
In my applications, I generally create a Util method that can provide a MIME type, based on the extension.
This solution will work if you can offer the download yourself for your Controller, eg. by calling the File() ActionResult. This also requires you to have access to the physical file, so you can stream it.
So, I'm not sure this fully answers your question, since you said the document is on a Sharepoint site...?
File()to stream it. I will either have to change it to host the file myself or tell the users that it's not going to open directly - Dismissile 2012-04-04 21:28