472,951 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Save a file on client

Is there a way to write a file on the client machine from an aspx page? I've
a custom query page and need to store the search criteria specified in an
XML file on the user machine from my web page (aspx). I form the XML at run
time from the search fileds specfied by the user and now my aspx page should
save it on client machine so that the user can open the same query on next
visit of the page.

And help is appreciated.

Nikhil
Nov 18 '05 #1
4 3970
Hi, Nikhil Tayal,

If the info is not that large you can save it as a cookie on the client.

If it is really large you can prompt the user to save it and on the next
visit to upload it. This is very bad design regarding the security though,
because the users can upload practically anything.

A standard solution is to keep this data in the server in the profile of the
user (supposing that you keep the profiles of your users and they (may)
authenticate before the visit to the page).

Greetings
Martin
"Nikhil Tayal" <a-******@microsoft.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
Is there a way to write a file on the client machine from an aspx page? I've a custom query page and need to store the search criteria specified in an
XML file on the user machine from my web page (aspx). I form the XML at run time from the search fileds specfied by the user and now my aspx page should save it on client machine so that the user can open the same query on next
visit of the page.

And help is appreciated.

Nikhil

Nov 18 '05 #2
Thanks for replying. I'll not be uploading anything back to server on next
visit, I'll just read the file, extract the XML and then use the xml to form
my query.

But my question remain unanswered - How do I save the text that I form at
runtime into a file on the client machine? Currently I use this:

xmlDoc = Session["XmlDocument"] as XmlDocument;
string fileName = "query.xml";
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" +
fileName);
Response.ContentType = "text/xml";
Response.Write(xmlDoc.OuterXml);
Response.Flush();

But this saves the XML as well as the source from the current aspx page. How
do I save just the XML and/or get rid of all other source from the file.

Nikhil

"Martin Dechev" <de******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi, Nikhil Tayal,

If the info is not that large you can save it as a cookie on the client.

If it is really large you can prompt the user to save it and on the next
visit to upload it. This is very bad design regarding the security though,
because the users can upload practically anything.

A standard solution is to keep this data in the server in the profile of the user (supposing that you keep the profiles of your users and they (may)
authenticate before the visit to the page).

Greetings
Martin
"Nikhil Tayal" <a-******@microsoft.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
Is there a way to write a file on the client machine from an aspx page?

I've
a custom query page and need to store the search criteria specified in an XML file on the user machine from my web page (aspx). I form the XML at

run
time from the search fileds specfied by the user and now my aspx page

should
save it on client machine so that the user can open the same query on next visit of the page.

And help is appreciated.

Nikhil


Nov 18 '05 #3
> But my question remain unanswered - How do I save the text that I form at
runtime into a file on the client machine?
I may be wrong, but your next question will be how to read the file on the
client machine from the aspx page. That's why I explained you how this
situation is usually handled.
xmlDoc = Session["XmlDocument"] as XmlDocument;
string fileName = "query.xml";
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" +
fileName);
Response.ContentType = "text/xml";
Response.Write(xmlDoc.OuterXml);
Response.Flush();

But this saves the XML as well as the source from the current aspx page. How do I save just the XML and/or get rid of all other source from the file.


Just like you do it, only call Response.End() instead of Response.Flush()

Greetings
Martin
Nov 18 '05 #4
You'd be MUCH better off using either Cookies, or even better XML UserData
persistence on the client.

See the topic here:
http://msdn.microsoft.com/library/de...am03052001.asp

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Nikhil Tayal" <a-******@microsoft.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
Is there a way to write a file on the client machine from an aspx page? I've a custom query page and need to store the search criteria specified in an
XML file on the user machine from my web page (aspx). I form the XML at run time from the search fileds specfied by the user and now my aspx page should save it on client machine so that the user can open the same query on next
visit of the page.

And help is appreciated.

Nikhil

Nov 18 '05 #5

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

Similar topics

14
by: edykstra | last post by:
Hello, If you point your browser to this page, http://prdownloads.sourceforge.net/vnc-tight/tightvnc-1.2.9_x86_viewer.zip?use_mirror=umn the server sends you the HTML page, and very soon...
1
by: lc | last post by:
Hi, Is there a way to save the client side opened asp page as a image file to the server side. That is take a screen shoot of the page and save it as a file preferrable html file or some...
4
by: Mr Gordonz | last post by:
Hi All, I want to be able to save a file from the client's PC on the server. The tricky part is the aspx page is never actually seen by the user. Basically, I have a VB application running on...
8
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they...
4
by: Matt | last post by:
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...
12
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page...
1
by: koraykazgan | last post by:
Hi all, I have to solve the following scenario. On my webpage, the user is able to view some text content. I have to put a "Save Document" button on that page. If the user wants to save that...
6
scubak1w1
by: scubak1w1 | last post by:
Hello, I have been Googling for a bit now as to how to let the user save the current page via a 'clickable icon' to an HTML file (i.e., on the client side.) That is, I am presenting a lot of...
3
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

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.