Solved

Best Practice: Viewing documents stored on a server in a web application

Posted on 2013-11-18
6
331 Views
Last Modified: 2013-12-10
Hello All,

I currently have Excel/Word/Text files saved on a remote server that I would like to run my web application on.  What are best practices for viewing the files as a user of the web application?  If possible, I would like to do so without saving the files locally.  If anybody could provide help it would be greatly appreciated.
0
Comment
Question by:uconnfb13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 39657543
Generally this can be handled by simply sending the file in the response, something like:

            Response.Clear();
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("content-disposition", "attachment; filename=" + Path.GetFileName(path));
            Response.TransmitFile(extract.FilePath);
            Response.End();

Open in new window

0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 39657548
Note that for this to work for Excel or Word, the clients will need to have Excel or Word (or some other app able to read them) installed locally.
0
 

Author Comment

by:uconnfb13
ID: 39673367
Thank you for the replies.  Is there something more that I need to do other than pasting in that C# snippet with the appropriate file path?  When I do so nothing happens.  No error, but nothing happens at all.

Thanks.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 39673444
Where are you pasting it?

The snippet was copied from actual working code, but context might matter.
0
 

Author Closing Comment

by:uconnfb13
ID: 39709472
Your solution worked.  The issue ended up being with the Update Panel on the page.  Thank you.
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 39709551
My pleasure
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question