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
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
Asp.net ÓÃurlÖØд(URLReWriter)ʵÏÖÈÎÒâ¶þ¼¶ÓòÃû
ÎÒ×î½üдÁ˸öСÀý×Ó,´ó¼Ò¿ÉÒÔÏÈ¿´Õâ¸ö,ÀïÃæÓÐСÀý×ÓµÄÍêÕû´úÂëÏÂÔØ.
http://www.cnblogs.com/notus/archive/2009/03/26/1422548.html
ºÃ¾ÃûÓÐд¼¼ÊõÎÄÕÂ,Èç¹û´ó¼Ò¿´²»Ã÷°×,¾Í¶à¿´¼¸Æª,º¹,»òÕß,ÔÚÎÄÕµĺóÃæ»Ø¸´(ÕâÊÇ×îÓÐЧµÄ°ì·¨),ÎһᾡÁ¦°ïÖú´ó¼Ò½â´ðÒÉ»ó.
À´ ......
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.HtmlControls;
using Microsoft.Practi ......
Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspx ......
°Ë¡¢ASP.NET Web ·þÎñÆ÷¿Ø¼þÄ£°å
´ó¶àÊý Web ·þÎñÆ÷¿Ø¼þ¾ßÓÐĬÈϵIJ¼¾ÖºÍÍâ¹Û£¬µ«ÊÇÄú¿ÉÒÔͨ¹ýÉèÖÃÊôÐÔ»òʹÓÃÑùʽÀ´²Ù×ÝËüÃÇ¡£²¿·Ö Web ·þÎñÆ÷¿Ø¼þ»¹ÔÊÐíÄúʹÓÃÄ£°åÀ´×Ô¶¨ÒåÆäÍâ¹Û¡£
Ä£°åÊÇÒ»×é HTML ÔªËغͿؼþ£¬ËüÃǹ¹³É¿Ø¼þÌض¨²¿·ÖµÄ²¼¾Ö¡£ÀýÈ磬ÔÚ DataList Web ·þÎñÆ÷¿Ø¼þÖУ¬Äú¿ÉÒ ......