ASP.NETÏÂÔØÎļþ´úÂë
ÈçºÎͨ¹ýASP.NETÀ´ÏÂÔØÎļþ£¬Õâ¸öÎÊÌâÎÒÃǾ³£Óöµ½£¬°Ñ³£Óõķ½·¨×ܽᵽһÆð£¬Ñ§Ï°Ñ§Ï°¡£µ±ÎÒÃÇÒªÈÃÓû§ÏÂÔØÒ»¸öÎļþ£¬×î¼òµ¥µÄ·½Ê½ÊÇͨ¹ýResponse.RedirectÖ¸Á
Response.Redirect("test.doc")
Äú¿ÉÒÔ°ÑÉÏÃæÕâÐÐÖ¸Áî·ÅÔÚButtonµÄClickʼþµ±ÖУ¬µ±Óû§µã»÷°´Å¥Ö®ºó£¬ÍøÒ³¾Í»á±»×ªÖ·µ½¸Ãwordµµ£¬Ôì³ÉÏÂÔصÄЧ¹û¡£
µ«ÊÇÕâÑùµÄÏÂÔØÓм¸¸öÎÊÌ⣺
1¡¢ÎÞ·¨ÏÂÔز»´æÔÚµÄÎļþ£ºÀýÈ磬ÎÒÃÇÈôÊÇÏë°Ñ³ÌÐò¶¯Ì¬(ÁÙʱ)²úÉúµÄÎÄ×Ö£¬µ±×÷Ò»¸öÎļþÏÂÔصÄʱºò(Ò²¾ÍÊǸÃÎļþÆäʵÔÏȲ¢²»ÊÇÕæµÄ´æÔÚ£¬¶øÊǶ¯Ì¬²úÉúµÄ)£¬¾ÍÎÞ·¨ÏÂÔØ¡£
2¡¢ÎÞ·¨ÏÂÔØ´æ´¢ÓÚÊý¾Ý¿âÖеÄÎļþ£ºÕâÊÇÀàËƵÄÎÊÌ⣬¸ÃÎļþ²¢Ã»ÓÐÕæµÄ´æÔÚ£¬Ö»ÊDZ»´æ·ÅÔÚÊý¾Ý¿âÖеÄij¸öλÖÃ(ij±Ê¼Ç¼ÖеÄij¸öÀ¸Î»)µÄʱºò£¬¾ÍÎÞ·¨ÏÂÔØ¡£
3¡¢ÎÞ·¨ÏÂÔز»´æÔÚÓÚWebÎļþ¼ÐÖеÄÎļþ£ºÎļþȷʵ´æÔÚ£¬µ«¸ÃÎļþ¼Ð²¢²»ÊÇ¿ÉÒÔ·ÖÏí³öÀ´µÄWebÎļþ¼Ð£¬ÀýÈ磬¸ÃÎļþµÄλÖÃÔÚC:\winnt£¬Äú×ܲ»»áÏëÒª°Ñ¸ÃÎļþ¼Ðµ±×÷WebÎļþ¼Ð°É?Õâʱºò£¬ÓÉÓÚÄúÎÞ·¨Ê¹ÓÃRedirectÖ¸Ïò¸ÃλÖã¬ËùÒÔÎÞ·¨ÏÂÔØ¡£
4¡¢ÏÂÔØÎļþºó£¬Ô±¾µÄÒ³Ã潫»áÏûʧ¡£
µäÐ͵Ä×´¿öÊÇ£¬ÎÒÃÇÒªÈÃÓû§ÏÂÔØÒ»¸ö.txtÎļþ»òÊÇ.csv¸ñʽµÄExcelÎļþ£¬µ«ÊÇ...
1¡¢Õâ¸öÎļþ¿ÉÄÜÊÇͨ¹ýASP.NET³ÌÐò¶¯Ì¬²úÉúµÄ£¬¶ø²»ÊÇȷʵ´æÔÚÓÚServer¶ËµÄÎļþ£»
2¡¢»òÊÇËüËäÈ»´æÔÚÓÚËÅ·þÆ÷¶ËµÄij¸öʵÌåλÖ㬵«ÎÒÃDz¢²»Ï뱩¶Õâ¸öλÖÃ(Èç¹ûÕâ¸öλÖù«¿ª£¬ºÜ¿ÉÄÜûÓÐȨÏÞµÄÓû§Ò²¿ÉÒÔÔÚÍøÖ·À¸ÉÏÊäÈëURLÖ±½ÓÈ¡µÃ!!!)
3¡¢»òÊÇÕâ¸öλÖò¢²»ÔÚÍøÕ¾ÐéÄâ·¾¶ËùÔÚµÄÎļþ¼ÐÖС£(ÀýÈçC:\Windows\System32...)
//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
Ïà¹ØÎĵµ£º
½ñÌìΪÁË×ö²åÈëÊý¾ÝÕÒÁ˲»ÉÙ¶«Î÷£¬ÒòΪ´ÓÀ´Ã»ÓÐд¹ý¶ÁдExcel£¬Ò²²»ÖªµÀ¸ÃÔõôд¡£ÏÂÃæµÄÊǽñÌìͨ¹ý²é¿´ÂÛ̳×Ô¼ºÐ´³öÀ´ÁË¡£
¹¦ÄÜÊǶÁÈ¡Excel È»ºó°ÑÊý¾Ý²åÈëÊý¾Ý¿â¡£Õâ¸ö¹¦ÄÜÔÚÆóÒµÀïÊǷdz£³£¼ûµÄÒ²Êdz£Óõģ¬Ï£Íû¶ÔÅóÓÑÃÇÓаïÖú£¡
/// <summary>
/// µ¼Èëexcel
/// </ ......
Èý¡¢ÈçºÎ£ºÉèÖà ASP.NET Web ·þÎñÆ÷¿Ø¼þÊôÐÔ
ÔÚ ASP.NET ÍøÒ³ÖУ¬¸ù¾ÝËùÐèµÄÊôÐÔ (Property) ÉèÖÿؼþÉùÃ÷µÄÊôÐÔ (Attribute)¡£
ÄúËùÉèÖõÄÈ·ÇÐÊôÐÔÈ¡¾öÓڿؼþºÍÊôÐÔ¡£ÓйØÌض¨¿Ø¼þµÄÊôÐÔµÄÐÅÏ¢£¬ÇëÔÚ“°ïÖú”Ë÷ÒýÖÐËÑË÷¸Ã¿Ø¼þÀàµÄÃû³Æ£¨ÀýÈ磬“Button Àà (System.Web.UI ......
Îå¡¢ASP.NET Web ·þÎñÆ÷¿Ø¼þºÍä¯ÀÀÆ÷¹¦ÄÜ
²»Í¬µÄä¯ÀÀÆ÷ºÍÏàͬä¯ÀÀÆ÷µÄ²»Í¬°æ±¾Ö§³Ö²»Í¬µÄ¹¦ÄÜ¡£ASP.NET ·þÎñÆ÷¿Ø¼þ»á×Ô¶¯È·¶¨·¢³öÒ³ÃæÇëÇóµÄä¯ÀÀÆ÷£¬²¢Îª¸Ãä¯ÀÀÆ÷³ÊÏÖÊʵ±µÄ±ê¼Ç¡£µ«ÊÇ£¬²¿·Ö¿Ø¼þ¹¦ÄÜÎÞ·¨ÔڽϵͰ汾µÄä¯ÀÀÆ÷ÉϳÊÏÖ£¬Òò´ËÐèÒªÔÚ¾¡¿ÉÄܶàµÄä¯ÀÀÆ÷ÀàÐÍÉϲ鿴ҳµÄÊä³ö£¬ÒÔÈ·±£Ò ......
°Ë¡¢ASP.NET Web ·þÎñÆ÷¿Ø¼þÄ£°å
´ó¶àÊý Web ·þÎñÆ÷¿Ø¼þ¾ßÓÐĬÈϵIJ¼¾ÖºÍÍâ¹Û£¬µ«ÊÇÄú¿ÉÒÔͨ¹ýÉèÖÃÊôÐÔ»òʹÓÃÑùʽÀ´²Ù×ÝËüÃÇ¡£²¿·Ö Web ·þÎñÆ÷¿Ø¼þ»¹ÔÊÐíÄúʹÓÃÄ£°åÀ´×Ô¶¨ÒåÆäÍâ¹Û¡£
Ä£°åÊÇÒ»×é HTML ÔªËغͿؼþ£¬ËüÃǹ¹³É¿Ø¼þÌض¨²¿·ÖµÄ²¼¾Ö¡£ÀýÈ磬ÔÚ DataList Web ·þÎñÆ÷¿Ø¼þÖУ¬Äú¿ÉÒ ......