asp.net文件下载[转]
1 public partial class FileDownLoad : System.Web.UI.Page
2 {
3 //提供下载的文件,不编码的话文件名会乱码
4 private string fileName = HttpContext.Current.Server.UrlEncode("规范.rar");
5 private string filePath = HttpContext.Current.Server.MapPath("规范.rar");
6 //使用TransmifFile下载文件
7 protected void btnDL1_Click(object sender, EventArgs e)
8 {
9 FileInfo info = new FileInfo(filePath);
10 long fileSize = info.Length;
11 Response.Clear();
12 Response.ContentType = "application/x-zip-compressed";
13 Response.AddHeader("Content-Disposition", "attachment;filename="+ fileName);
14 //不指明Content-Length用Flush的话不会显示下载进度
15
相关文档:
在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......
ObjectDataSource 控件基于 SelectMethod、InsertMethod、UpdateMethod 或 DeleteMethod 属性中所标识的方法名称以及组成业务对象方法签名的参数名来调用业务对象方法。在业务对象中创建方法时,必须确保业务对象方法所接受的参数名和类型与 ObjectDataSource 控件传递的参数名和类型匹配。(参数顺序并不重要。)
  ......
首先看数据库表结构:
代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
StartClientCaching();
......
一.Code Behind简介
Code Behind就是所谓的代码分离,自从Microsoft公司推出了ASP.NET以后,Code
Behind就是一个热门的话题。在一般的ASP.NET文件中,Code
Behind主要是用二个文件来创建一个ASP.NET的页面,其中一个是设计文件,一般以.aspx或者.ascx做为扩展名,而另外一个是程序代码文
件,一般以.vb或者.cs做为 ......