Response.Redirect Word Word Glitch?

I find a desperate and broken man ...

I am developing an enterprise intranet / search engine application. When users open the document, my ASP.NET code writes the action to the Windows event log and then issues "Response.Redirect" (for security / auditing).

Process: - User clicks the LinkButton "Open My Document.doc" - Postback occurs - Server-side code writes the action that opens the user's document to the SQL + Windows event log - Response.Redirect goes to the specified document

Works great for everything except Word documents. EG, PDF, JPG are ok. Using Word 2007.

Code:

Response.Redirect("http://intranet/wcm/mydocument.doc");

      

When I call this code and an existing instance of Word is open, Word simply blinks any documents that are already open in the taskbar. When a user clicks on an annoying blinking instance of Word in the taskbar, it instantly opens the document it should have been. Org!

WHY!? It drives me crazy.

***** Sidenote: * Internet Explorer ignores the clientide javascript "window.open" if a Word document is specified. Therefore, I cannot use this. ***

+2


source to share


1 answer


It seems that the decision process depends on Microsoft Word after the document is loaded. At this point, it is disabled for the browser because its job is done. You might want to change the Mime type of the download so that Word / IE doesn't immediately recognize it and the user is forced to save it to disk (and this might be more like how other browsers will handle it) ...



Edit: Straight from Microsoft, info on how to force download for a known mime type . If you choose this path, the Content-Disposition header must be programmatically set. You will need to customize the upload process by replacing Response.Redirect with something else, like an ASPX page that changes its headers as desired for upload (like Content-Disposition) and then programmatically reads the file from disk and writes it to response is an output stream. Microsoft has many good code samples in their MSDN docs in the Write methods of the HttpResponse class ; you will most likely find one or a combination of them.

+1


source







All Articles