Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 BehaviorEditorPart Web ·þÎñÆ÷¿Ø¼þ¸ÅÊö


      BehaviorEditorPart Web ·þÎñÆ÷¿Ø¼þÊÇÒ»¸ö±à¼­Æ÷²¿¼þ¿Ø¼þ£¬×îÖÕÓû§¿ÉÒÔʹÓøÿؼþÔÚÔËÐÐʱ¸ü¸Ä¹ØÁªµÄ WebPart ¿Ø¼þÉϵĶà¸öÓû§½çÃæ (UI) ÊôÐÔ¡£Ï±íÁгöÁËÓû§¿É×Ô¶¨ÒåµÄ¹¦ÄÜ£¬ÒÔ¼°Óû§¿ÉʹÓà BehaviorEditorPart ¿Ø¼þ±à¼­µÄ¶ÔÓ¦µÄ WebPart ¿Ø¼þÊôÐÔÖµ¡£
Óû§¿É×Ô¶¨ÒåµÄ¹¦ÄÜ
WebPart ......

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


      ʹÓà Web ²¿¼þ¿Ø¼þ£¬¿ÉÒÔÈÃÓû§ÔÚÔËÐÐʱ´´½¨Á½¸ö·þÎñÆ÷¿Ø¼þÖ®¼äµÄÁ¬½Ó£¬ÒÔÐγÉÁ¬½Ó²¢¹²ÏíÊý¾Ý¡£Ò»¸ö¿Ø¼þÓÃ×÷Êý¾ÝµÄÌṩÕߣ¬ÁíÒ»¸ö¿Ø¼þÓÃ×÷Êý¾ÝµÄʹÓÃÕß¡£ÕâÁ½¸ö¿Ø¼þ¿ÉÒÔÊÇ WebPart ¿Ø¼þ»òÈÎºÎÆäËûÀàÐ͵ķþÎñÆ÷¿Ø¼þ¡£±ØÐ뽫ËüÃÇÉè¼ÆÎª´¦ÀíÁ¬½ÓÇÒλÓÚ WebPartZoneBase ÇøÓòÖС£
 
ÔÚ ......

asp.netÖÐʹÓÃjavascriptµÄ·½·¨¼°Çø±ð

1.ʹÓà ʹÓÃResponse.Write£¬ÕâÖÖ·½·¨»á°ÑJS´úÂëдÔÚÒ³ÃæµÄ×î¶¥²¿(µÄÇ°Ãæ)£º
2. ʹÓ㺠page.ClientScript.RegisterStartupScript£¨£©£» ÕâÖÖ·½·¨»á°ÑJS´úÂëǶÈëÔÚÒ³ÃæµÄµ×²¿¡¢±íµ¥µÄ×îºó (Ç°Ãæ)£¬ÊÊÓÃÓÚÒªÔÚÒ³Ãæ¿Ø¼þ¼ÓÔØÍê³ÉºóÔËÐеÄJS´úÂë
3.ʹÓÃRegisterClientScriptBlock£¨£©£»ÕâÖÖ·½·¨»á°ÑJS´úÂëǶÈëÔÚÒ³ÃæµÄ¶¥²¿¡¢ ......

ASP.NETµÄ¹¤×÷Ô­Àí

ASP.NETµÄ¹¤×÷Ô­Àí

ÔÚ¶àÊý³¡ºÏÏ£¬¿ÉÒÔ½«ASP.NETÒ³Ãæ¼òµ¥µØ¿´³ÉÒ»°ãµÄHTMLÒ³Ãæ£¬Ò³Ãæ°üº¬±ê¼ÇÓÐÌØÊâ´¦Àí·½Ê½µÄһЩ´úÂë¶Î¡£µ±°²×°.NETʱ£¬±¾µØµÄIIS Web·þÎñÆ÷×Ô¶¯ÅäÖóɲéÕÒÀ©Õ¹ÃûΪ.aspxµÄÎļþ£¬ÇÒÓÃASP.NETÄ£¿é(ÃûΪaspnet_isapi.dllµÄÎļþ)´¦ÀíÕâЩÎļþ¡£
´Ó¼¼ÊõÉϽ²£¬ASP.NETÄ£¿é·ÖÎöASPXÎļþµÄÄÚÈÝ£¬²¢½«ÎļþÄÚÈ ......

ASP.NET µ¯³öÌáʾ¿òËùÓÐÖÖÀà

Ìí¼ÓÒ»¸öÀࣺ°ÑÏÂÃæµÄÎļþ·ÅÔÚÀàÖоͿÉÒÔÁË¡£
using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
  public  class MessageBox
    {
      public  MessageBox()
        {
 & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ