Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NETÎļþÏÂÔغ¯ÊýʹÓÃ

 ASP.NETÎļþÏÂÔغ¯ÊýʹÓÃÊÇʲôÇé¿öÄØ£¿ÔÚÄãµÄPage_LoadÖÐÌí¼ÓÕâÑùµÄ´úÂë:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "Ä¿µÄÎļþÃû³Æ", @"Ô´Îļþ·¾¶", 1024000);
if (!success) Response.Write("ÏÂÔØÎļþ³ö´í£¡"); Page.Response.End();
ASP.NETÎļþÏÂÔغ¯Êý´úÂëΪ:
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 = 200;
//ÿÃë5´Î ¼´5*10K bytesÿÃë int sleep = (int)Math.Floor(1000 * pack / _speed) + 1;
if (_Request.Headers["Range"] != null)
{
_Response.StatusCode = 206;
string[] range = _Request.Headers["Range"].Split(new char[] {'=', '-'});
startBytes = Convert.ToInt64(range[1]);
}
_Response.AddHeader("Content-Length", (fileLength - startBytes).ToString());
if (startBytes != 0) {
//Response.AddHeader("Content-Range", string.Format(" bytes {0}-{1}/{2}", startBytes, fileLength-1, fileLength));
}
_Response.AddHeader("Connection", "Keep-Alive");
_Response.ContentType = "application/octet-stream";
_Response.AddHeader("Content-Disposition","attachment; filename=" + HttpUtility.UrlEncode(_fileName,System.Text.Encoding.UTF8) ); br.BaseStream.Seek(startBytes, SeekOrigin.Begin);
int maxCount = (int) Math.Floor((fileLength - startBytes) / pack) + 1;
for (int i = 0; i < maxCount; i++) { if (_Response.IsClientConnected) { _Response.BinaryWrite(br.ReadBytes(int.Parse(pack.ToString()))); Thread.Sleep(sleep);
} else { i=maxCount;
}
} }
catch
{
return false;
}
finally
{
br.Close();
myFile.Close();
}
}
catch
{
return false;
}
return true;
}
ÕâÑù¾ÍʵÏÖÁË


Ïà¹ØÎĵµ£º

ASP.NET±ÊÊÔÌâÄ¿

 ADO.NET³ÌÐòÉè¼ÆÄ£ÄâÌâ(¹²206Ìâ)
1
ADO.NET Ä£ÐÍÖеÄÏÂÁÐÄÄЩ¶ÔÏóÊôÓÚConnected ¶ÔÏó
A. Connection
B. DataAdapter
C. DataReader
D. DataSet
ÕýÈ·´ð°¸:ABC
2
ÔÚADO.NET ÖÐ,Ϊ·ÃÎÊDataTable ¶ÔÏó´ÓÊý¾ÝÔ´ÌáÈ¡µÄÊý¾ÝÐÐ.¿ÉʹÓÃDataTable ¶ÔÏóµÄ_______ÊôÐÔ.
A. Rows
B. Columns
C. Constraints
D. Data ......

asp.net¹¤×÷Ô­Àí


ASP.NETµÄÒ³Ãæ³õʼ»¯ÓëʼþÏê½â
 
Ò»¡¢³õʼ»¯
¡¡¡¡·µ±Ò³Ãæ±»Ìá½»ÇëÇóµÚÒ»¸ö·½·¨ÓÀÔ¶Êǹ¹Ô캯Êý¡£Äú¿ÉÒÔÔÚ¹¹Ô캯ÊýÀïÃæ³õʼһЩ×Ô¶¨ÒåÊôÐÔ»ò¶ÔÏ󣬲»¹ýÕâʱºòÒòΪҳÃ滹ûÓб»ÍêÈ«³õʼ»¯ËùÒÔ¶àÉÙ»áÓÐЩÏÞÖÆ¡£ÌرðµØ£¬ÄúÐèҪʹÓÃHttpContext¶ÔÏó¡£µ±Ç°¿ÉÒÔʹÓõĶÔÏó°üÀ¨QueryString, FormÒÔ¼°Cookies¼¯ºÏ£ ......

tempÎļþ¼ÐȨÏÞ¶ÔASPÍøÕ¾ÒÔ¼°ASP.NETÍøÕ¾µÄÓ°Ïì

 ×öÍøÕ¾Óë¸ã°²È«Ò»°ã¶¼Àë²»¿ªÈ¨ÏÞ·ÖÅä,ÍøվȨÏÞÒ»°ã¶¼Ö±½ÓÉèÖÃÕ¾µãËùÔÚµÄÐéÄâĿ¼µÄ,Ò²¾ÍÊÇÔÚÐéÄâĿ¼µÄ°²È«ÀïÌí¼ÓinternetÀ´±öÕË»§,²¢·ÖÅä³ýÍêÈ«¿ØÖÆÍâµÄËùÓÐȨÏÞ;Èç¹ûÊÇ.NET,»¹±ØÐë¸øASP.NETÓû§ÅäÖóýÍêÈ«¿ØÖÆÒÔÍâµÄȨÏÞ! 
Ò»°ãÇé¿öÏÂ,ÕâÑù¾ÍOKÁË,·þÎñÆ÷ÉϵÄÒ»°ãÍøÕ¾¶¼¿ÉÒÔÕý³£ÔËÐÐÁË!µ«ÏÖÔÚÎÒ·¢ÏÖ:C\WINDOWS ......

windows 7 ÏÂASP.net ±¾µØÅäÖà ( IIS 7)

 ½ñÌìµ÷ÊÔblend 3µÄÒ»¸öZune3DÑùÀýʱ, ÔËÐкóÉú³ÉµÄÊÇsliverlight³ÌÐò, ÓÉÓÚÎҵĻúÆ÷ÊǸմÓvistaÉý¼¶µ½windows 7, iis¶¼Ã»ÓÐÅäÖÃ, Òò´ËÎÞ·¨Ô¤ÀÀ.ÏÖ¸ø³ö²½Öè:
(Ò». ÅäÖÃIIS)
1. ´ò¿ª"Control Panel" / "Programs" / "Turn Windows features on or off",  ¹´Ñ¡"Internet Information Services", windows 7ĬÈϹ´Ñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ