Solved

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

Posted on 2013-11-18
6
329 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
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

Independent Software Vendors: 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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

763 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