Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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.Lengt


Ïà¹ØÎĵµ£º

ASP.NET×Ô¶¨Òå´íÎóÒ³Ãæ

1¡¢Ìí¼ÓWeb.config£¬ < system.web>< /system.web>ÖÐÌí¼Ó< customErrors mode="On"
defaultRedirect="ApplicationErroy.aspx" >< /customErrors>½Úµã£¬
2¡¢Ìí¼ÓGlobal.asaxÎļþ£¬ÕÒµ½Application_Errorʼþ£¬¼ÓÈëÒÔÏ´úÂ룺   
//ÕâÊÇÌí¼ÓÁËÒ»¸öÈ«¾ÖÓ¦ÓÃ³Ì ......

ʹÓÃASP.NET Global.asax Îļþ

Global.asax Îļþ£¬ÓÐʱºò½Ð×ö asp.net Ó¦ÓóÌÐòÎļþ£¬ÌṩÁËÒ»ÖÖÔÚÒ»¸öÖÐÐÄλÖÃÏìÓ¦Ó¦ÓóÌÐò¼¶»òÄ£¿é¼¶Ê¼þµÄ·½·¨¡£Äã¿ÉÒÔʹÓÃÕâ¸öÎļþʵÏÖÓ¦ÓóÌÐò°²È«ÐÔÒÔ¼°ÆäËüһЩÈÎÎñ¡£ÏÂÃæÈÃÎÒÃÇÏêϸ¿´Ò»ÏÂÈçºÎÔÚÓ¦ÓóÌÐò¿ª·¢¹¤×÷ÖÐʹÓÃÕâ¸öÎļþ¡£
¸ÅÊö
Global.asax λÓÚÓ¦ÓóÌÐò¸ùĿ¼Ï¡£ËäÈ» Visual Studio .NET »á×Ô¶¯²åÈëÕ⸠......

ASP.NET¶àƵµÀÍøÕ¾¼Ü¹¹ÊµÏÖ·½·¨

Ö÷Ìå¼Ü¹¹
¡¡¡¡¸÷ƵµÀ·Ö±ðλÓÚ²»Í¬µÄWeb Project(¾ßÓжÀÁ¢µÄ¶þ¼¶ÓòÃû)£¬²¢½«ËùÓеÄÒµÎñÂß¼­ÒÔ¼°Êý¾Ý·ÃÎʹ¦ÄÜ·â×°³ÉClass Library£¬ËùÓÐÆµµÀ¹²ÓÃÕâ¸öClass Library¡£ 
¡¡¡¡ÏÂÃæÏêϸ½éÉÜʵÏÖ·½·¨¡£ 
¡¡¡¡¼ÙÉèÍøÕ¾ÓÐÈý¸öƵµÀ£¬ÐÂÎÅ¡¢ÂÛ̳ÒÔ¼°²©¿Í£¬¶ÔÓ¦µÄ¶þ¼¶ÓòÃûΪ"news"¡¢"forum"¡¢"blog"¡£³ý´ËÖ®Í⣬»¹ÐèÒªÁ ......

Ò»¸ö¼òµ¥µÄASP.NET·ÃÎÊMySqlÊý¾Ý¿â

ÏÂÔØ ADO.NET Driver for MySQLMySql.Data.dll
°²×°ºó£¬ÔÚ°²×°Ä¿Â¼ÏÂÃæÕÒµ½Assemblies
Îļþ¼Ð£¬ÕÒµ½ MySql.Data.dll
(´ËÎļþÊÇ.Net·ÃÎÊMySQLÊý¾Ý¿âµÄÒ»¸öÇý¶¯£¬ÍêÈ«ADO.NETÊý¾Ý·ÃÎÊģʽ£¬ÓÉMySQL¹Ù·½Ìṩ£¬Óжà¸ö°æ±¾¿ÉÑ¡Ôñ¡£)
 Ñ§Ï°µÄÒ»¸öÁ´½Ó£ºhttp://www.cnblogs.com/wcfgroup/articles/1242256.html
´´½¨Ò»¸ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ