Solved

Save File From ASP.NET

Posted on 2014-04-02
2
293 Views
Last Modified: 2014-04-03
I want to give users a way to download files from my website.

How do I display a dialog like this?

Screen Snapshot
0
Comment
Question by:Ray Turner
2 Comments
 
LVL 2

Accepted Solution

by:
GowthamNatarajan earned 500 total points
ID: 39974293
Try this....        


string fileName = "test.xls";
        string filePath = Server.MapPath("~/test.xls");
        Response.Clear();

        Response.AppendHeader("content-disposition", "attachment; filename=" + fileName);
        Response.ContentType = "application/octet-stream";
        Response.WriteFile(filePath);
        Response.Flush();
        Response.End();
0
 

Author Closing Comment

by:Ray Turner
ID: 39974756
Thanks!   Exactly what I needed.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

821 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