ÓÃC#(ASP.NET)ÔõôʵÏÖÎļþÏÂÔØ¹¦ÄÜ
using System;
using System.Data;
using System.Configuration;
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 System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//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());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();
}
//WriteFile·Ö¿éÏÂÔØ
protected void Button3_Click(object sender, EventArgs e)
{
string fileName = "aaa.txt";//¿Í»§¶
Ïà¹ØÎĵµ£º
¶Ô“Ìí¼Ó”¡¢“Ìá½»”¡¢“±£´æ”¡¢“¸üДµÈ°´Å¥ÐèÒª¶ÔÊý¾Ý¿â½øÐÐд²Ù×÷µÄ°´Å¥£¬Ò»¶¨ÒªÔÚÒ³Ãæ³õʼ»¯Ê±¼ÓÔØ½Å±¾£¬·ÀÖ¹¶à´ÎÖØ¸´µã»÷£¬ÀýÈ磺
protected void Page_Load(object sender, EventArgs e)
{
//.net 2.0ÒÔÉÏ
......
·½·¨Ò»£º
HtmlProxy.cs£º
using System.Text;
using System.IO;
/// <summary>
/// HtmlProxy µÄժҪ˵Ã÷
/// </summary>
public class HtmlProxy
{
public HtmlProxy()
{
//
......
ÉÏ´ÎÎÒÃÇ˵µ½µÄ±àÒë³ÉµÄdllÎļþÓëcsÎļþÔÚͬһĿ¼ÖУ¬¶ø²»»á·Åµ½ÐéÄâĿ¼µÄbinĿ¼ÖУ¬ÈçºÎ×ö²ÅÄܹ»°Ñcs
Îļþ±àÒë³ÉdllÇÒ×Ô¶¯·Åµ½ÐéÄâĿ¼µÄbinÎļþ¼ÐÖÐÄØ£¿
¿ªÊ¼-------³ÌÐò-------Microsoft Visual Studio.NET 2003-------Visual Studio.NET¹¤¾ß£¬µã»÷ÆäÖеēVisual Studio.NET2003ÃüÁîÌáʾ”£¬¾Í»á½øÈëMic ......
ǰ̨´úÂ룺
<script type="text/javascript">
<%=LoadImage() %>
imgUrl1="uploads/"+ImgSrc[0];
imgtext1=ImgAlt[0]
imgLink1=escape("adimg.aspx?Img_ID="+ImgUrl[0]);
imgUrl2="uploads/"+ImgSrc[1];
imgtext2=ImgAlt[1]
imgLink2=escape("adimg.aspx?Img_ID="+ImgUrl[1]);
imgUrl3=" ......
ASP.NETÒ³ÃæÌø×ªÓÐʲô·½·¨ÄØ£¿£¬ÏÖÔÚ¸ø´ó¼Ò½éÉÜÈýÖÖ·½·¨£¬ËûÃǵÄÇø±ðÊÇÊ²Ã´ÄØ£¿ÈÃÎÒÃÇ¿ªÊ¼°É£º
ASP.NETÒ³ÃæÌø×ª1¡¢response.redirect Õâ¸öÌø×ªÒ³ÃæµÄ·½·¨Ìø×ªµÄËٶȲ»¿ì£¬ÒòΪËüÒª×ß2¸öÀ´»Ø(2´Îpostback)£¬µ«Ëû¿ÉÒÔÌø תµ½ÈκÎÒ³Ãæ£¬Ã»ÓÐÕ¾µãÒ³ÃæÏÞÖÆ(¼´¿ÉÒÔÓÉÑÅ»¢Ìøµ½ÐÂÀË)£¬Í¬Ê±²»ÄÜÌø¹ýµÇ¼±£»¤¡£µ«ËÙ¶ÈÂýÊÇÆä×î´óȱÏÝ ......