Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÔÚASP.NETÖÐÏÂÔØÎļþ

//TransmitFileʵÏÖÏÂÔØ
    protected void Button1_Click(object sender, EventArgs
e)
    {
        /*
       
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öÐµķ½·¨TransmitFileÀ´½â¾öʹÓÃResponse.BinaryWrite
       
ÏÂÔØ³¬¹ý400mbµÄÎļþʱµ¼ÖÂAspnet_wp.exe½ø³Ì»ØÊÕ¶øÎÞ·¨³É¹¦ÏÂÔØµÄÎÊÌâ¡£
        ´úÂëÈçÏ£º
        */
        Response.ContentType = "application/x-zip-compressed";
       
Response.AddHeader("Content-Disposition",
"attachment;filename=z.zip");
        string filename =
Server.MapPath("DownLoad/z.zip");
       
Response.TransmitFile(filename);
    }
    //WriteFileʵÏÖÏÂÔØ
    protected void Button2_Click(object sender,
EventArgs e)
    {
        /*
        using System.IO;
        */
        string fileName = "asd.txt";//¿Í»§¶Ë±£´æµÄÎļþÃû
       
string filePath = Server.MapPath("DownLoad/aaa.txt");//·¾¶
        FileInfo fileInfo = new FileInfo(filePath);
       
Response.Clear();
        Response.ClearContent();
       
Response.ClearHeaders();
        Response.AddHeader("Content-Disposition",
"attachment;filename=" + fileName);
       
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
      &


Ïà¹ØÎĵµ£º

ASP.NET¿çÒ³Ãæ´«Öµ

½ñÌìTMȺÀïÓÐÈËÎÊÆð¹ØÓÚÒ³Ãæ´«ÖµµÄ·½·¨£¬ÓÖÒý·¢ÁËÒ»³¡ÌÖÂÛ¡£¿´À´Õâ¸ö»¹ÊÇÓкܶàÈ˹Ø×¢µÄ£¬Òò´ËÎÒ¾ÍÎÒ¸öÈ˹۵ã×öÁËЩ×ܽᣬϣÍû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
¡¡¡¡1.  ʹÓÃQueryString±äÁ¿
¡¡¡¡¡¡¡¡QueryStringÊÇÒ»Öַdz£¼òµ¥µÄ´«Öµ·½Ê½£¬Ëû¿ÉÒÔ½«´«Ë͵ÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖС£Èç¹ûÊÇ´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ ......

ÓÃASP.NET¶ÁÈ¡QQÏà²á

 ×î½üÓöµ½Òª¶ÁÈ¡QQÏà²áµÄÎÊÌ⣬ËùÒÔ×Ô¼ºÚÂÄ¥ÁËÏ£¬°Ñ¶ÁÈ¡Ïà²áµÄ˼·ºÍ´úÂëдÏÂÀ´¡£ 
      ºÜ¶àÍøÕ¾µ½Í¼Æ¬Á´½Ó¶¼×öÁ˵ÁÁ´´¦Àí¡£Òâ˼ÊÇÈç¹ûÄãÏëÔÚ²»ÊÇËûµÄÍøÕ¾ÉÏÒýÓÃͼƬ¾Í²»»áÕýÈ·ÏÔʾͼƬ£¬¶øÊÇÒ»ÕÅÆäËüµÄ°æÈ¨ËµÃ÷Ö®ÀàµÄͼƬ¡£ÊµÏÖ·ÀµÁÁ´µÄÒ»°ã×öºÃÊÇͨ¹ýÅжÏRequestµÄHeadersÖеÄRe ......

ASP.NET¹Ø±Õµ±Ç°´°¿Úͬʱ´ò¿ªÒ»¸öд°¿Ú

Ê×ÏÈ,ÔÚpageloadÀïдÈëÒÔÏ´úÂë:Response.Write("<script>window.opener=null;window.close();</script>");
Æä´Î,ÔÚheadÀïдÏÂÈçÏÂJS´úÂë: <script language="JavaScript">
<!--
function openwin() { window.open ("Default.aspx", "newwindow", "height=600, width=600, toolbar=no, menubar=n ......

Asp.NetÔÚÏßͳ¼ÆÓû§Áбí

1¡¢ÔÚÏßÓû§ÁбíµÄʵÏÖ
ÔÚASPʱ´ú£¬ÒªÊµÏÖÒ»¸öÍøÕ¾µÄÔÚÏßÓû§ÁбíÏÔʾ¹¦ÄܵĹßÓÃ×ö·¨ÊÇÐÞ¸Äglobal.asaÎļþÖеģºApplication_Start¡¢Session_StartºÍSession_EndÕâÈý¸öº¯Êý¡£ÔÚASP.NETʱ´ú£¬ÎÒÒÀÈ»ÕâÑù×ö¡£µ«ÊDZØÐë×¢ÒâºÜ¶àÎÊÌâ¡£Ê×ÏÈÀ´¿´¿´×î¼òµ¥µÄ´úÂëʵÏÖ£º
protected void Application_Start(Object sender, EventArg ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ