[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

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

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
uconnfb13
Asked:
uconnfb13
  • 4
  • 2
1 Solution
 
Jens FiedererTest Developer/ValidatorCommented:
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
 
Jens FiedererTest Developer/ValidatorCommented:
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
 
uconnfb13Author Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Jens FiedererTest Developer/ValidatorCommented:
Where are you pasting it?

The snippet was copied from actual working code, but context might matter.
0
 
uconnfb13Author Commented:
Your solution worked.  The issue ended up being with the Update Panel on the page.  Thank you.
0
 
Jens FiedererTest Developer/ValidatorCommented:
My pleasure
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now