Solved

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

Posted on 2013-11-18
6
317 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
  • 4
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 23

Expert Comment

by:Jens Fiederer
Comment Utility
Where are you pasting it?

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

Author Closing Comment

by:uconnfb13
Comment Utility
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
Comment Utility
My pleasure
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now