ĬÈÏÖ»ÄÜÉÏ´«2M¸½¼þ, ÈçºÎ·Å¿ªÏÞÖÆ? (asp.net C#)
¶ÔÓÚasp.net,ĬÈÏÖ»ÔÊÐíÉÏ´«2MÎļþ,Ôö¼ÓÈçÏÂÅäÖÃ,Ò»°ã¿ÉÒÔ×Ô¶¨Òå×î´óÎļþ´óС.
<httpRuntime executionTimeout="300" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/>
ÎÒÃÇÔÚÉÏ´«´óÎļþʱ¶¼Óöµ½¹ýÕâÑù»òÄÇÑùµÄÎÊÌâ¡£ÉèÖúܴóµÄmaxRequestLengthÖµ²¢²»ÄÜÍêÈ«½â¾öÎÊÌ⣬ÒòΪASP.NET»áblockÖ±µ½°Ñ
Õû¸öÎļþÔØÈëÄÚ´æºó£¬ÔÙ¼ÓÒÔ´¦Àí¡£Êµ¼ÊÉÏ£¬Èç¹ûÎļþºÜ´óµÄ»°£¬ÎÒÃǾ³£»á¼ûµ½Internet ExplorerÏÔʾ "The page
cannot be displayed - Cannot find server or DNS
Error"£¬ºÃÏñÊÇÔõôҲcatch²»ÁËÕâ¸ö´íÎó¡£ÎªÊ²Ã´£¿ÒòΪÕâÊǸöclient side´íÎó£¬server
side¶ËµÄApplication_ErrorÊÇ´¦Àí²»µ½µÄ£¬¿ÉÒԲο¼Õâ¸öÌû×ÓÑо¿Ò»Ï²úÉúÕâ¸ö´íÎóµÄ»úÀí¡£
handling server error when upload file too large
½â¾öµÄ·½·¨ÊÇÀûÓÃÒþº¬µÄHttpWorkerRequest£¬ÓÃËüµÄGetPreloadedEntityBody ºÍ
ReadEntityBody·½·¨´ÓIISΪASP.NET½¨Á¢µÄpipeÀï·Ö¿é¶ÁÈ¡Êý¾Ý,Chris
HynesΪÎÒÃÇÌṩÁËÕâÑùµÄÒ»¸ö·½°¸(ÓÃHttpModule)£¬¸Ã·½°¸³ýÁËÔÊÐíÄãÉÏ´«´óÎļþÍ⣬»¹ÄÜʵʱÏÔʾÉÏ´«½ø¶È¡£
IServiceProvider provider = (IServiceProvider) HttpContext.Current;
HttpWorkerRequest wr = (HttpWorkerRequest) provider.GetService(typeof(HttpWorkerRequest));
byte[] bs = wr.GetPreloadedEntityBody();
....
if (!wr.IsEntireEntityBodyIsPreloaded())
{
int n = 1024;
byte[] bs2 = new byte[n];
while (wr.ReadEntityBody(bs2,n) >0)
{
.....
}
}
¸ÐлChris HynesÌṩÁËͨ¹ýHttpModule(Krystalware.HttpUploadManager)ʵÏÖ ASP.NET´óÎļþÉÏ´«µÄ´úÂ룺
(ÆäÖÐHttpUploadSpike.rarÊÇ ASP.NET´óÎļþÉÏ´«¿ªÔ´°æ±¾[ÓÐһЩСBUG£¬Ð޸ķ½·¨¼ûÏÂÎÄ]
SlickUpload-2.5.2.rarÊÇ ASP.NET´óÎļþÉÏ´«×îеķǿªÔ´°æ±¾)
ʹÓÃChris HynesÌṩµÄ´úÂë
Ïà¹ØÎĵµ£º
//ÔÚµ±Ç°Ò³ÖйرÕ
Response.Write("<Script>window.opener.opener= null;window.opener.location.replace(window.opener.location.href='ideabank.aspx');window.close();</Script>");
//¸¸ÀàÒ³´ò¿ª ×ÓÒ³
Response.Write("<script>window.open('upideabank.aspx?id="+id+"','','height=50 ......
ÿ´Î½«ÍøÒ³·¢Ë͵½·þÎñÆ÷ʱ£¬¶¼»á´´½¨ÍøÒ³ÀàµÄÒ»¸öÐÂʵÀý¡£ÔÚ´«Í³µÄ Web ±à³ÌÖУ¬Õâͨ³£Òâζ×ÅÔÚÿһ´ÎÍù·µÐгÌÖУ¬Óë¸ÃÒ³¼°¸ÃÒ³ÉϵĿؼþÏà¹ØÁªµÄËùÓÐÐÅÏ¢¶¼»á¶ªÊ§¡£ÀýÈ磬Èç¹ûÓû§½«ÐÅÏ¢ÊäÈëµ½Îı¾¿ò£¬¸ÃÐÅÏ¢½«ÔÚ´Óä¯ÀÀÆ÷»ò¿Í»§¶ËÉ豸µ½·þÎñÆ÷µÄÍù·µÐгÌÖжªÊ§¡£
ΪÁ˽â¾ö´«Í³µÄ Web ±à³Ìµ ......
״̬¹ÜÀíÊÇÄú¶Ôͬһҳ»ò²»Í¬Ò³µÄ¶à¸öÇëÇóά»¤×´Ì¬ºÍÒ³ÐÅÏ¢µÄ¹ý³Ì¡£ÓëËùÓлùÓÚ HTTP µÄ¼¼ÊõÒ»Ñù£¬Web ´°ÌåÒ³ÊÇÎÞ״̬µÄ£¬ÕâÒâζ×ÅËüÃDz»×Ô¶¯Ö¸Ê¾ÐòÁÐÖеÄÇëÇóÊÇ·ñÈ«²¿À´×ÔÏàͬµÄ¿Í»§¶Ë£¬»òÕßµ¥¸öä¯ÀÀÆ÷ʵÀýÊÇ·ñÒ»Ö±Ôڲ鿴ҳ»òÕ¾µã¡£´ËÍ⣬µ½·þÎñÆ÷µÄÿһÍù·µ¹ý³Ì¶¼½«Ïú»Ù²¢ÖØд´½¨Ò³£»Òò´ ......
Ó¦ÓóÌÐò״̬Êǿɹ© ASP.NET Ó¦ÓóÌÐòÖеÄËùÓÐÀàʹÓõÄÊý¾Ý´¢´æ¿â¡£Ëü´æ´¢ÔÚ·þÎñÆ÷µÄÄÚ´æÖУ¬Òò´ËÓëÔÚÊý¾Ý¿âÖд洢ºÍ¼ìË÷ÐÅÏ¢Ïà±È£¬ËüµÄÖ´ÐÐËٶȸü¿ì¡£ÓëÌض¨ÓÚµ¥¸öÓû§»á»°µÄ»á»°×´Ì¬²»Í¬£¬Ó¦ÓóÌÐò״̬ӦÓÃÓÚËùÓеÄÓû§ºÍ»á»°¡£Òò´Ë£¬Ó¦ÓóÌÐò״̬ÓÃÓÚ´æ´¢ÄÇЩÊýÁ¿½ÏÉÙ¡¢²»ËæÓû§µÄ±ä»¯ ......
¿´ÁËÄÇô¶à£¬»¹ÊÇÇ××Ô¶¯ÊÖʵ¼ùÏÂÓÐЧ¹û¡£
ÒýÓà °Ù¶È ÑîÔÆ·ÉaiÉú»î
ASP.NET 2.0 ʵÏÖα¾²Ì¬ÍøÒ³·½·¨
·½·¨Ò»£ºÀûÓÃHttphandlerʵÏÖURLÖØд£¨Î±URL¼°Î±¾²Ì¬£©
ÎÒÃÇÓÐʱºò»á¼ûµ½ÕâÑùµÄµØÖ·£º“http://www.huoho.com/show-12-34.html”£¬Äã»òÐíÈÏΪÔÚÕ¾µã·þÎñÆ÷¸ùĿ¼“/”Ï´æÔÚÃûΪ“show- ......