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 ÊôÐÔÖÐËù±êʶµÄ·½·¨Ãû³ÆÒÔ¼°×é³ÉÒµÎñ¶ÔÏó·½·¨Ç©ÃûµÄ²ÎÊýÃûÀ´µ÷ÓÃÒµÎñ¶ÔÏó·½·¨¡£ÔÚÒµÎñ¶ÔÏóÖд´½¨·½·¨Ê±£¬±ØÐëÈ·±£ÒµÎñ¶ÔÏó·½·¨Ëù½ÓÊܵIJÎÊýÃûºÍÀàÐÍÓë 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 ......
ÔÎijö´¦£ºhttp://www.cnblogs.com/raymond19840709/archive/2007/09/11/890045.html
×÷Õߣº´ó¿Ú×Ð
µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToSt ......
Ö÷Ìå¼Ü¹¹
¡¡¡¡¸÷ƵµÀ·Ö±ðλÓÚ²»Í¬µÄWeb Project(¾ßÓжÀÁ¢µÄ¶þ¼¶ÓòÃû)£¬²¢½«ËùÓеÄÒµÎñÂß¼ÒÔ¼°Êý¾Ý·ÃÎʹ¦ÄÜ·â×°³ÉClass Library£¬ËùÓÐÆµµÀ¹²ÓÃÕâ¸öClass Library¡£
¡¡¡¡ÏÂÃæÏêϸ½éÉÜʵÏÖ·½·¨¡£
¡¡¡¡¼ÙÉèÍøÕ¾ÓÐÈý¸öƵµÀ£¬ÐÂÎÅ¡¢ÂÛ̳ÒÔ¼°²©¿Í£¬¶ÔÓ¦µÄ¶þ¼¶ÓòÃûΪ"news"¡¢"forum"¡¢"blog"¡£³ ......