473,406 Members | 2,336 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,406 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 3999
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.