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");//·¾¶
Ïà¹ØÎĵµ£º
¡¾Ïà¶Ô·¾¶¡¿
Request.ApplicationPath
/src
Path.GetDirectoryName(HttpContext.Current.Request.RawUrl )
\\src\\Xiaoshe
Context.Request.Path
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.CurrentExecutionFilePath
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.FilePath
/src/Xiaoshe/Xiaoshe ......
<script language="javascript" type="text/javascript">
¡¡¡¡function doubleSalary()
¡¡¡¡{
¡¡¡¡var employee = new Object();
¡¡¡¡employee.FirstName = "X";
¡¡¡¡employee.LastName = "PP";
¡¡¡¡employee.Salary = 1000;
......
Ö±½Ó»ñµÃÒ³Ãæ²ÎÊý£º
if(!IsPostBack) { //ÅжÏÊÇ·ñÊǵÚÒ»´Î¼ÓÔØ´°Ìå
}
if(Page.PreviousPage!=null){ // ÅжÏÉÏÒ»Ò³ÃæµÄ°´Å¥ÊÇ· ......
ASP.NETÌṩµÄÕ¾µãµØͼΪÎÒÃǽ¨Á¢µ¼º½À¸ºÍ²Ëµ¥ÌṩÁ˼«´óµÄ·½±ã¡£´ËÍâÎÒÃÇ»¹¿ÉÒÔ½¨Á¢×Ô¼ºµÄÕ¾µãµØͼÌṩ³ÌÐò£¬´Ó¶øʹÎÒÃǵIJ˵¥Ïî¿É¿Ø¡£
ÏÈÀ´Á˽âÏÂmenuµÈµ¼º½¿Ø¼þÓëÕ¾µãµØͼµÄ¹Øϵ¡£ÎÒÃÇÔÚASP .NETÏîÄ¿ÖÐËù½¨Á¢µÄweb.siteMap Æäʵ¾ÍÊÇÒ»¸ö× ......
ASP.NETÏÂÔØ——word,txt,ͼƬ·½·¨
¡¡¡¡±¾ÎÄÖ÷Òª½éÉÜASP.NETÏÂÔØÖîÈçword,txt,ͼƬµÈµÄ·½·¨¡£
¡¡
¡¡ try
¡¡¡¡{
¡¡¡¡FullFileName = Server.MapPath(FileName); //FileName--ÒªÏÂÔصÄÎļþÃû
¡¡¡¡FileInfo DownloadFile= new FileInfo(FullFileName);
¡¡¡¡if(Down ......