开发者

Asp.Net Range-Specific Requests ThreadAbortException Thread was being aborted

I am using class at http://pastebin.com/aK0zcxMN ( a version of http://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx) to protect downloads from leech and provide resume. It works fine but every now and then i get

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)

My site is a mobile site and there are gazillions of different mobile browsers around with different approaches to downloads. They also usually connects via operators gateway so I guess it is something to do with client disconnection or wap proxy problem.

What i am trying to do is how can i stop this happening. I don't want 开发者_运维技巧to try catc and igonore it. I've read about

catch (ThreadAbortException ex)

and

Thread.ResetAbort();

but could not implement it in to the class successfully. Has anyone used similar code to protect leeching?


if you are using

Response.Redirect("Some URL");

then try this

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

In this case the responce will not end and you dont need to handle it using catch block. But make sure your flow will not disturb.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜