Re: Save ASPX page on client programmatically
- From: FreeNEasy <FreeNEasy@xxxxxxxxxxxxxxxx>
- Date: Fri, 2 Mar 2007 07:41:18 -0800
@Norman:
You are right, the browser's save function would be fine for this. There are
two reasons why I need to have a button on the page for it:
reason 1: Without the intention to offend someone: there ARE users out there
who don't know THAT and HOW they can save a page displayed in their browser.
Since the document is a contract document and it is important that the user
can save it, (and does save it) a clearly visible save-button is the more
secure way to have the document saved.
reason 2: I am programming this for a customer and he WANTS the save-button.
Besides, if I would like to modify the content for formatting etc. I first
need to have the content. The ASPX page ist made of a form with text and
fields, how can I get the rendered content, I can't find it.
"Norman Yuan" wrote:
It depends on what do you want user to save. Since it is web application,.
all user gets is a page rendered in a browser, according to HTML tags. If
you want user to save the page as it is, then the browser's "Save" menu is
what it means, why try to invent the wheel again. If what you want user to
save is the data displayed on the page, but in different format (say, PDF),
you need then to re-organise your data in wanted format and send to browser
as download stream. Or because of the current page has too many decorations,
you want to save a clean printable version, then you can simply make a plain
printable version of the page, to let user still be able to save with
standard browser "Save" command.
I do not see the point when user can save the page easily, while you still
want him to save the exactly same page as download via a "Save" button.
"FreeNEasy" <FreeNEasy@xxxxxxxxxxxxxxxx> wrote in message
news:B17FA360-4E60-41EA-A6F3-BC6CA159DF87@xxxxxxxxxxxxxxxx
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 on the client's computer? He/she could do this using
the
browser (file/save), but I need to have it done by pressing the
pushbutton.
In my serverside code I get the button-click-event, I also know how to get
data to the client (including file-save-dialog), but where can I get the
page's content?
The download code could look like this (with ??? being actually my
question):
Response.AddHeader("Content-Disposition", "attachment;
filename=Contract.html");
Response.AddHeader("Content-Length", ???.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Write(???);
Response.End();
Maybe I'm completely wrong and there is an other better way to do it.
Please
help!
- Follow-Ups:
- Re: Save ASPX page on client programmatically
- From: Steven Cheng[MSFT]
- Re: Save ASPX page on client programmatically
- References:
- Re: Save ASPX page on client programmatically
- From: Norman Yuan
- Re: Save ASPX page on client programmatically
- Prev by Date: Error:denotes a 'field' where a 'class' was expected
- Next by Date: Re: Datasource property missing for ASP.NET Textbox in VS.NET 2005
- Previous by thread: Re: Save ASPX page on client programmatically
- Next by thread: Re: Save ASPX page on client programmatically
- Index(es):
Relevant Pages
|