Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Save a file on client

Reply
Thread Tools

Save a file on client

 
 
Nikhil Tayal
Guest
Posts: n/a
 
      02-27-2004
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


 
Reply With Quote
 
 
 
 
Martin Dechev
Guest
Posts: n/a
 
      02-27-2004
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" <(E-Mail Removed)> wrote in message
news:uXVBcMW$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Nikhil Tayal
Guest
Posts: n/a
 
      02-27-2004
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" <(E-Mail Removed)> wrote in message
news:%231MiEbW$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:uXVBcMW$(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
Martin Dechev
Guest
Posts: n/a
 
      02-27-2004
> 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


 
Reply With Quote
 
Eric Lawrence [MSFT]
Guest
Posts: n/a
 
      02-27-2004
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" <(E-Mail Removed)> wrote in message
news:uXVBcMW$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save contents of iframe from parent's save button user ASP .Net 1 04-04-2005 07:44 PM
word will not save or save as Alex B Computer Support 5 07-10-2004 05:23 AM
How do you get or save a file from/to a client (button on web page) once they are authenticated? The client could be Mac, Linux or Windows. jake ASP .Net 6 07-07-2004 07:48 PM
Save, Save As, Paste Phil Edwards Computer Support 1 06-27-2004 03:32 PM
Save alternative file on right-click->save-picture-as Shahar Golan Javascript 5 10-16-2003 05:01 PM



Advertisments