asp.net实现文件下载(wap手机下载)
这个问题困扰了我两天,手机下载
protected void Page_Load(object sender, EventArgs e)
{
string filename = Server.UrlDecode(Request["upload"]);
string filePath = Server.MapPath("upload/" + filename);//路径
FileDownload(filePath);
}
/// <summary>
/// 文件下载
/// </summary>
/// <param name="FullFileName"> </param>
private void FileDownload(string FullFileName)
{
try
{
FileInfo DownloadFile = new FileInfo(FullFileName);
if (DownloadFile.Exists)
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
//Response.ContentType = "application/octet-stream";//通知浏览器下载文件而不是打开
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
&nb
相关文档:
在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......
众所周知,WEB上的打印是比较困难的,常见的WEB上打印的方法大概有三种:
1、直接利用IE的打印功能。一般来说,这种方法可以做些扩展,而不是单单的调用javascript:print()这样简单,比如,可以使用如下代码:
<OBJECT
id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</ ......
test.xml
<?xml version="1.0" encoding="utf-8" ?>
<root>
<R SecuCode="601600" Glossary="学IT网测试获取XML结果显示正常,。。。。。。。哈哈" />
<R SecuCode="600056" Glossary="测试第二个,。。。。。。。哈哈" />
</root>
下面xml解析 ......
在注册表 System->CurrentControlSet->Services->Eventlog 处选择添加系统中 AspNet 这个账户注意是在右键的 安全->权限->添加
写日志
public static void Log(string sourceName, string message)
{
EventLog eventLog = null;
......
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
private XmlDo ......