473,287 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Save a file locally for ASP.net 2

Hi,
I would like to save a file locally (on the client computer) in an ASP.net
application.
It is like the server would return some data that the user can save to a
file on his local PC.
The ASP page has a text field to type in the file path directly and a
"Browse..." button, that shall display a "Save as..." dialog.
I tried with the FileUpload control, but this does not work, since I do not
want to upload an existing file, but I want to save a new file locally.
Any idea how this can be done?

Thanks and best regards, Matt
May 12 '06 #1
4 2554
im not sure you'd be able to to be honest (although I could be wrong). it
would be waay to much of a security risk.

the only way I can think of is generate the file on the server with the name
entered, stick it in a temporary directory unique to the session, and then
fire a download link, to prompt the user to download and open|save the file.

hth
"Matt" wrote:
Hi,
I would like to save a file locally (on the client computer) in an ASP.net
application.
It is like the server would return some data that the user can save to a
file on his local PC.
The ASP page has a text field to type in the file path directly and a
"Browse..." button, that shall display a "Save as..." dialog.
I tried with the FileUpload control, but this does not work, since I do not
want to upload an existing file, but I want to save a new file locally.
Any idea how this can be done?

Thanks and best regards, Matt

May 12 '06 #2
You can't do that, this would be a major security hole if a web page could
automatically save a page to a given location on the client hard drive.

You will have to stream out the file, and the user will be prompted with a
save dialog - and have to save that way, which is the usual manner of
downloading files.

"Matt" <ma**@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
Hi,
I would like to save a file locally (on the client computer) in an ASP.net
application.
It is like the server would return some data that the user can save to a
file on his local PC.
The ASP page has a text field to type in the file path directly and a
"Browse..." button, that shall display a "Save as..." dialog.
I tried with the FileUpload control, but this does not work, since I do
not
want to upload an existing file, but I want to save a new file locally.
Any idea how this can be done?

Thanks and best regards, Matt

May 12 '06 #3
You can't save a file on the client computer from the server.

You can let the user download a file, as musosdev suggested.

You can create an ActiveX control or Java applet to put on the web page,
that runs on the client and saves a file. This of course requires that
the user accepts that the control is started.

Matt wrote:
Hi,
I would like to save a file locally (on the client computer) in an ASP.net
application.
It is like the server would return some data that the user can save to a
file on his local PC.
The ASP page has a text field to type in the file path directly and a
"Browse..." button, that shall display a "Save as..." dialog.
I tried with the FileUpload control, but this does not work, since I do not
want to upload an existing file, but I want to save a new file locally.
Any idea how this can be done?

Thanks and best regards, Matt

May 12 '06 #4
Thanks for all answers. This solved my problem.
Matt
May 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael Rogers | last post by:
I dunno how save a file locally! How can I copy a file (http://foo.com/foo.zip) to my local server (http://mydomain.com/temp/foo.zip)? I saw a sample in MS Quick Start but I can't manipulate it...
8
by: kieran | last post by:
Hi, I want to download an image from the web and save it locally. I have spent all day messing about with this and am still no where. We have a firewall so i use the below code. I know it...
4
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the...
2
by: standish22 | last post by:
want to open a word document stored in my database. What I do is save the document locally, and then open a new winform that has the WebBrowser Control on it and navigate to that new file. ...
0
by: Matt Schwartz | last post by:
I have a ASP.NET web application written using VB.NET. I have a data grid, that is sent to the browser as an excel document using the following code Private Sub CreateXLS(ByVal xdatagrid As...
4
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found...
2
by: Adam | last post by:
On one site I'm working on I occasionally get an error where instead of executing the PHP file as per normal, the browser sees the page as a file (therefore opens up a execute/save pop-up). All...
6
by: greg_e | last post by:
Is there a way to create a form in a local html file where the contents of the form are written to a local file when a 'save' button is selected? It would be nice if it was as easy as changing...
5
by: Arch Stanton | last post by:
I have a set of ASPX pages that work fine on my home computer (Vista), and on a server at work (XP). I just got a new laptop at work (XP) and these same files don't work on it. I installed IIS and...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.