ASP.NETÎļþÏÂÔØº¯Êý
ÔÚÄãµÄPage_LoadÖÐÌí¼ÓÕâÑùµÄ´úÂë:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "Ä¿µÄÎļþÃû³Æ", @"Ô´Îļþ·¾¶", 1024000);
if (!success)
Response.Write("ÏÂÔØÎļþ³ö´í£¡");
Page.Response.End();
ÎļþÏÂÔØº¯Êý´úÂëΪ:
public static bool ResponseFile(HttpRequest _Request,HttpResponse _Response,string _fileName,string _fullPath, long _speed)
{
try
{
FileStream myFile = new FileStream(_fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
BinaryReader br = new BinaryReader(myFile);
try
{
_Response.AddHeader("Accept-Ranges", "bytes");
_Response.Buffer = false;
long fileLength = myFile.Length;
long startBytes = 0;
double pack = 10240; //10K bytes
//int sleep 
Ïà¹ØÎĵµ£º
ASP.NET´ò¿ªÐÂÒ³Ãæ¶ø²»¹Ø±ÕÔÀ´µÄÒ³Ãæ
Respose.Write("<script language='javascript'>window.open('"+ url +"');</script>"); £¨´ò¿ª¼ò½à´°¿Ú£©£º
Respose.Write("<script l ......
ÈçºÎ£ºÔÚ ASP.NET ÍøÒ³ÖÐʵÏֻص÷
ÔÚ¿Í»§¶Ë»Øµ÷ÖУ¬¿Í»§¶Ë½Å±¾º¯Êý»áÏò ASP.NET ÍøÒ³·¢ËÍÇëÇ󣬸ÃÍøÒ³Ëæºó»áÔËÐÐÆäÕý³£ÉúÃüÖÜÆÚµÄ¼ò»¯°æ±¾ÒÔ´¦Àí¸Ã»Øµ÷¡£ÈôҪȷ±£»Øµ÷ʼþÔ´ÓÚÔ¤ÆÚµÄÓû§½çÃæ (UI)£¬¿ÉÒԶԻص÷½øÐÐÑéÖ¤¡£Ôڻص÷ÑéÖ¤ÖУ¬Ó¦ÏÈÔÚÍøÒ³³ÊÏÖ¹ý³ÌÖÐ×¢²áÒªÑéÖ¤µÄʼþ£¬È»ºóÔڻص÷¹ý³ÌÖжԸÃʼþ½øÐÐÑéÖ¤¡£Óйػص÷µ ......
Ò»¡¢ÐÞ¸ÄÅäÖÃWeb.ConfigÎļþÖеÄhttpRuntime½Úµã
¶ÔÓÚasp.net,ĬÈÏÖ»ÔÊÐíÉÏ´«4MÎļþ,Ôö¼ÓÈçÏÂÅäÖÃ,Ò»°ã¿ÉÒÔ×Ô¶¨Òå×î´óÎļþ´óС.
Ò»¡¢ÐÞ¸ÄÅäÖÃWeb.ConfigÎļþÖеÄhttpRuntime½Úµã
¶ÔÓÚasp.net,ĬÈÏÖ»ÔÊÐíÉÏ´«4MÎļþ,Ôö¼ÓÈçÏÂÅäÖÃ,Ò»°ã¿ÉÒÔ×Ô¶¨Òå×î´óÎļþ´óС.
<httpRuntime
executionTimeout="800"
maxRequestLengt ......
ASP.NETÏÂÔØ——word,txt,ͼƬ·½·¨
¡¡¡¡±¾ÎÄÖ÷Òª½éÉÜASP.NETÏÂÔØÖîÈçword,txt,ͼƬµÈµÄ·½·¨¡£
¡¡
¡¡ try
¡¡¡¡{
¡¡¡¡FullFileName = Server.MapPath(FileName); //FileName--ÒªÏÂÔØµÄÎļþÃû
¡¡¡¡FileInfo DownloadFile= new FileInfo(FullFileName);
¡¡¡¡if(Down ......