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

ASP.NETÎļþÏÂÔØº¯ÊýʹÓÃdzÎö

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 ASP.NET Web ²¿¼þÉúÃüÖÜÆÚ


      ÔÚ½« ASP.NET Web ²¿¼þµÄ¼¯³É¿Ø¼þ¼¯ÖеĿؼþ°üÀ¨ÔÚÍøÒ³ÖÐʱ£¬ÕâЩ¿Ø¼þ½«×ñÊØ¸ÃÒ³µÄ¹æÔò£»¾ßÌå¶øÑÔ¾ÍÊÇ£¬ÕâЩ¿Ø¼þ½«ÔÚ¸ÃÒ³µÄÉúÃüÖÜÆÚÄÚÔËÐС£
ÿ¸öÍøÒ³¶¼¾ßÓÐÒ»¸öÉúÃüÖÜÆÚ£¬ÍøÒ³ÔÚÆäÉúÃüÖÜÆÚÄÚ½«Ö´ÐÐһϵÁд¦Àí²½Öè¡£ÕâЩ²½Öè°üÀ¨³õʼ»¯¡¢´´½¨¿Ø¼þ¡¢»¹Ô­ºÍά»¤×´Ì¬¡¢ÔËÐÐʼþ´¦Àí³ÌÐò´ú ......

ASP.NET ImportCatalogPart Web ·þÎñÆ÷¿Ø¼þ¸ÅÊö


      ImportCatalogPart Web ·þÎñÆ÷¿Ø¼þ¿Éµ¼Èë WebPart ¿Ø¼þµÄ˵Ã÷Îļþ£¨»òÓÃ×÷ WebPart ¿Ø¼þµÄÆäËû ASP.NET ·þÎñÆ÷¿Ø¼þ£©¡£ÕâÑù¾Í¿ÉÒÔ½«¸Ã¿Ø¼þͨ¹ýÔ¤ÏÈÖ¸¶¨µÄÉèÖÃÌí¼Óµ½ÍøÒ³ÖС£¸Ã˵Ã÷ÎļþʹÓû§¿ÉÒÔ¹²Ïí WebPart ¿Ø¼þµÄÉèÖá£
˵Ã÷ÎļþÓë¿Ø¼þ±¾Éí²»Í¬¡£ËüÊÇÒÔ .WebPart ÎļþÀ©Õ¹Ãû½áβµÄ XM ......

asp.netÊý¾Ý¿Ø¼þ Êý¾Ý°ó¶¨¿Ø¼þ±È½Ï


Êý¾Ý°ó¶¨¿Ø¼þ±È½Ï
(Reapter\DataList\GridView\DatailsView\FormView):
1.²åÈ빦ÄÜ·½Ãæ:
DetailsViewºÍFormView¾ßÓвåÈ빦ÄÜ,ÆäËü¿Ø¼þûÓÐ
2.Ä£°å
DataList\FormView\RepeaterÈýÖÖ±ØÐë±à¼­Ä£°å,¶ø
GridViewºÍDetailsViewÖ»ÓÐÔÚ½«ÁÐת»»³ÉÄ£°åÁÐÒÔºó²Å»á³öÏÖ¸÷ÖÖÄ£°å.
3.×Ô¶¯·ÖÒ³¹¦ÄÜ
GridView ,DetailsViewºÍForm ......

asp.netÊý¾Ýµ¼³öµ½word

ÎÒ¾õµÃÕâ¸öÎÄÕ²»ÄÜËãÎÒµÄÔ­´´£¬ÒòΪ´úÂëÒ²ÊÇÎÒ´Ó±ðµÄµØ·½ÕÒµ½µÄ£¬¶øÇÒÎÒÔÚÍøÉϲéÁË£¬»ù±¾É϶¼ÊÇÕâÌ×´úÂë¡£
ͨÓõİÑÊý¾Ýµ¹½øword»òÕßexcel¡£ÕâÀïµÄµ¼ÈëexcelºÍÎÒ֮ǰµÄÄÇÆªÎÄÕÂÖеķ½·¨ÊDz»Ò»ÑùµÄ¡£
´úÂëÈçÏ£º
aspxÒ³ÃæÖУº
<form id="form1" runat="server">
       &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ