Solved

How can I popup a save dialog in asp.net

Posted on 2004-08-10
3
388 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
3 Comments
 
LVL 3

Accepted Solution

by:
nhewitt21 earned 20 total points
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

10 Experts available now in Live!

Get 1:1 Help Now