2010-07-03 35 views
0

我使用http://pastebin.com/aK0zcxMNhttp://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx版本)的类来保护下载免受水蛭攻击并提供简历。它工作正常,但每一个现在,然后我得到Asp.Net范围特定请求ThreadAbortException线程正在中止

System.Threading.ThreadAbortException: Thread was being aborted. 
at System.Web.UnsafeNativeMethods.EcbFlushCore(IntPtr pECB, Byte[] status, Byte[] header, Int32 keepConnected, Int32 totalBodySize, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32 doneWithSession, Int32 finalStatus, Int32 kernelCache, Int32 async, ISAPIAsyncCompletionCallback asyncCompletionCallback) 
at System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.FlushCore(Byte[] status, Byte[] header, Int32 keepConnected, Int32 totalBodySize, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32 doneWithSession, Int32 finalStatus, Boolean& async) 
at System.Web.Hosting.ISAPIWorkerRequest.FlushCachedResponse(Boolean isFinal) 
at System.Web.Hosting.ISAPIWorkerRequest.FlushResponse(Boolean finalFlush) 
at System.Web.HttpResponse.Flush(Boolean finalFlush) 
at System.Web.HttpResponse.Flush() 
at ResumeDownload.ProcessDownload(String fileName, String headerFileName, String fileMimeType) 
at FileDownloader.Page_Load(Object sender, EventArgs e) 

我的网站是一个移动网站,并有不同的方法来下载各地的不同的移动浏览器gazillions。他们通常还通过运营商网关连接,所以我猜这是与客户端断开连接或wap代理问题有关。

我想要做的是如何停止这种情况。我不想尝试catc和igonore它。我读过有关

catch (ThreadAbortException ex) 

Thread.ResetAbort(); 

,但对类无法实现它成功。有没有人使用类似的代码来保护水蛭?

回答

1

如果您正在使用

Response.Redirect("Some URL");

那就试试这个

Response.Redirect("Some URL",false);

在这种情况下,性反应不会结束,你不需要使用catch块来处理它。但要确保你的流量不会打扰。