Web Forms :: Delete After Prompt Download Of File?
Jul 22, 2010
I believe this question has been asked before but I still couldn't find the appropriate answer.
My scenario is like this:
When the user click on a button, it will dynamically generate a .xls and prompt the user to download.I have used transmitfile but it doesn't allows the file to be deleted. I have also used outputstream.write but it doesn't delete the file after flush. Instead it will hold onto the .xls and no modification can be done to the file.
I'm currently trying to write data (client machine) into a xml file where the user can save. However, I want the users to be able to decide on where they want to save this written xml file. Is there any controls or codes that I can use to allow the users to save the file?.
Does anyone know how this is possible? I can retrieve the file, but I cannot figure out or find anywhere online how to prompt the user where he/she wants to download the file to.
i am downloading a file from a server and i plan to delete the file that i have downloaded on the server after it gets downloaded on the client side. My download code is working fine but i dont know when to put the command to delete the file.
string filepath = restoredFilename.ToString(); // Create New instance of FileInfo class to get the properties of the file being downloaded FileInfo myfile = new FileInfo(filepath); // Checking if file exists if (myfile.Exists) { // Clear the content of the response Response.ClearContent(); // Add the file name and attachment, which will force the open/cancel/save dialog box to show, to the header Response.AddHeader("Content-Disposition", "attachment; filename=" + myfile.Name); //Response.AddHeader("Content-Disposition", "inline; filename=" + myfile.Name); // Add the file size into the response header Response.AddHeader("Content-Length", myfile.Length.ToString()); // Set the ContentType Response.ContentType = ReturnExtension(myfile.Extension.ToLower()); //// Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead) Response.TransmitFile(myfile.FullName); // End the response Response.End(); }
Now i know the response.End() will stop every thing and return the value, so is there another way too do so. I need to call a function
DeleteRestoredFileForGUI(restoredFilename);
to delete the file but dont know where to put it.. i tried putting before and after Response.End() but it does not work.
But when i browse the URL above in phone browse, the phone will show the image file in phone browse. But what i need to do is prompt user to download and save it.
when ever i click on the delete button,then one Message box should come, it must ask "Are You sure Do YOU want to delete this record?" it should have two options YES and NO ,if i click YES the Record should be delete and if I click on NO ,the record will not be deleted. how can i do this in C#.net and in asp.net.?
I'm trying to write code that will allow a user to click a button and be prompted to save an image file that resides on the web server. I'm using the following code, but I get an error that says "Error: Could not complete the operation due to error c00ce514.".
[Code]....
I have verified that the file exists. Is there another method for prompting users to save a file to their local machine?
I've problem when I Export my data to Excel and response to Client.
I want :
When Client Downloaded File Excel, On server will delete that file. Current, when Export, on my Server will genaral an Excel File and I call Response.Redirect(fileExcel), Client enable Download that file.
But, If I don't delete that file on server then my server will full by time.Whether any way to download from FileStream Or something the same?
Or any body have an other way to after Client Download then Server delete fileExcel?
I am downloading file from database using the following code. This code downloads an excel file from the database which has a macro attached to it when it is opened. This macro reads file name of the excel file and uses it for its computation. Everthing works file if user saves the file on his harddisk and then open if but if he directly opens the file from the dialog(by hitting 'Open' button) then file name of the opened excel file comes out be the name of the webform that has the above code and this leads to error in the macro. Is there any option through which i can control the name of the file if user directly opens the file from dialog or the option to disable or remove 'Open' button form the dialog?
I'm about to submit my pad file to multiple sharware sites but the pad file has to have a direct link to the download file and can't link to a download page which is what I would like to do, so I can track the traffic and get the downloader's email before allowing the download. I am running an ASP.NET site in VB. Is there a way to tell the web app to redirect to a specific aspx page when it receives a request for a specific file?
I have VB code that parses XML data from a webpage. Up until 2 days ago the XML data could be viewed right on the page and I could just grab the HTML source code to get the information. Now they have changed the page to a link button to download the XML file.
The problem is that when I click on the XML link I get the 'File Download Prompt' which asks me to run or save the file. I figured I could just save the file to temp directory and then open it up to parse it in my VB app but I can't figure out how to grab the file from the browser in my application.
Currently I have the text file going to desktop, in ASP how can I prompt a file save dialog for the user? The result is string from the streamreader as "result" as follows:
StreamWriter FileWriter = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "file.txt")); FileWriter.Write(result); FileWriter.Close();
This block of code display Download file Dialog for Open or Save the attached file.It's working fine in Mozila Firefox and IE8 but doesn't display Download file Dialog box in IE 7
I have made an application where I am displaying the .pdf , .doc , .docx files. These files are uploading from an Admin Panel.When user place a mouse pointer on download icon provided in front of every file, it shows the complete path where it’s get saved.I want to avoid this path visibility even when user place mouse on download icon and even if it Inspect an element (as most modern browser will have this functionality).
I'm trying to force a large (200+ MB) file to download that's on a remote server. The problem is that I can't use the "WriteFile()" function, since I'm not using a virtual path. Then, when I try:
i have this WCF application which is hosted as a windows service. This service has to download mails which have CSV attached to them from a pop3 account. After getting that CSV i have to delete that mail from the pop3 account so that it is not downloaded again. How can i do it?
I need to retrieve and save a word document from a xml document ... I can retrieve name, phone number that and all .but i do no how download and save a word document from xml database .
i m creating asp.net Mobile website page to download symbian .sis file to mobile ,but its not geting download properly.its working perfectly on desktop.
Error message says there is another application using that file at the moment.However, I cannot find where the problem is since I have already disposed all the instances based on that file.What's more odd is after I close the debug page, I can easily remove that page in OS file system.
I want to download an exe/ msi file from server to client so I used hyperlink control and gave filepath in navigateurl property of hyperlink control , but it is working for small sized files and for large file it shows error as CGI time out problem . Is there any solution to resolve this problem. Also downloading exe file using hyperlink, is it a good method? Is any other solution to download the file.