?
Solved

How can I popup a save dialog in asp.net

Posted on 2004-08-10
3
Medium Priority
?
409 Views
Last Modified: 2007-12-19
How can I popup a save dialog in asp.net to save a some text and in the same page I want to provide a option to print the same content

Thanks in advance for your help
0
Comment
Question by:sasikumar06
[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
3 Comments
 
LVL 3

Accepted Solution

by:
nhewitt21 earned 80 total points
ID: 11772363
Heres some code to do a popup save as dialog:
Response.ContentType = "application/octet-stream";
Response.AddHeader("content-disposition", "attachment; filename=" + myFileName);        // myFileName is the variable that holds the name of your text file etc

FileStream sourceFile = new FileStream(myFileName, FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();

Response.BinaryWrite(getContent);

and here is a link to info regarding Reading/Writing data to text files: http://www.automatedqa.com/techpapers/textfiles_net.asp

Hope this helps you out, thanx
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

764 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