views:

16

answers:

0

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?