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
相关文档:
在服务器端,处理一个ASP.NET Web Form需要几个步骤,在每个步骤都会引发各种事件,这就允许你把网页插入到任一步骤的处理流中并且响应任何你所期望的处理。
以下是ASP.NET网页处理流中的几个主要步骤
1.网页框架初始化
2.用户代码初始化
......
前言
FCKeditor是使用非常广泛的HTML编辑器,本文从 ASP.NET 的使用场景对 FCKeditor 与 FCKeditor.NET 的配置、功能扩展(如自定义文件上传子目录、自定义文件名、上传图片的后期处理等)、以及安全性进行初步的阐述。
希望能帮助有同样需求的同仁节省一点时间;也希望各位能指正其中的不足。谢谢。
一、自定义 FCKedit ......
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 ......
你只要在Web,config文件的 system.web 配置节下添加以下配置:
<globalization requestEncoding="GB2312" responseEncoding="GB2312"/>
当然,你也可以将“GB2312”改为系统默认的“UTF-8”,只要加上这一配置,页面间传值的乱码问题就解决了。 ......
通常javascript代码可以与HTML标签一起直接放在前端页面中,但如果JS代码多的话一方面不利于维护,另一方面也对搜索引擎不友好,因
为页面因此而变得臃肿;所以一般有良好开发习惯的程序员都会把javascript代码放到独立的js文件中,其他页面通过引入该js文件来使用相应的
javascript代码。
今天在做一个小新闻系统的管理 ......