I am working on a web application project to be deployed on an intranet. I need to provide users with the ability to allocate documents to projects so that I can show them a page that lists the documents for a project. When they click on the document I need it to open in the application that created it. Generally, just Word and Excel documents.
So, I've done all the 'Add a Document' stuff and I have a Gridview on the screen that displays the document name (test.doc) and the path (C:\Users\Fred\Test.doc).
I have tried passing the Document Name and Document Path to this function:
and, for example, for my Word document it opens - but not before a 'Do you want to Open or Save this file dialog is presented' (unwanted, but not the end of the world) but, when the file opens you can't save it. (Even on my development box).
protected void ShowFile(string DocumentName, string DocumentPath)
Response.ContentType = "application/octet-stream";
Response.AddHeader("content-disposition", "attachment;filename=\"" + DocumentName + "\"");
Is there a simple way of simply opening an Office document from within a .net web application project that just actually opens the document - so it can be edited and saved etc.
Thanks for any help.
Edit: When the word file opens - if I click to save it it shows this as the path to the file:
C:\Users\Fred\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\7T5D07IA\Test.doc
So, it's not opening the original file at all - it's creating a copy of it. I want users to simply be able to click on a file and open it. If I use 'C:\Users\Fred\Test.doc' as a desktop shortcut - click on it and the file opens - the actual file - you can edit and save it. Why is it so hard to get a Word document to open from within a .net Web Application?