本文介绍了以编程方式在客户端上保存ASPX页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


场景:


有一个ASPX页面显示一些文字并且在

底部:保存,打印和关闭。打印和关闭由javascript完成。但是如何将
保存在客户端的计算机上呢?他/她可以使用

浏览器(文件/保存)执行此操作,但我需要按下按钮完成此操作。


在我的服务器端代码我得到了按钮点击事件,我也知道如何获取

数据给客户端(包括文件保存对话框),但我在哪里可以获得

页面的内容?


下载代码看起来像这样(实际上我的问题是???):


回复.AddHeader(" Content-Disposition"," attachment;

filename = Contract.html");

Response.AddHeader(" Content-Length" ,? ??。Length.ToString());

Response.ContentType =" application / octet-stream";

Response.Write(???);

Response.End();


也许我完全错了,还有另外一种更好的方法。请

帮助!

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!

推荐答案










这篇关于以编程方式在客户端上保存ASPX页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 07:28
查看更多