In web application, i am using code, to download the documnet which is uploaded, which is written in item command event of datalist, but it s giving error like \"Thread was
Your Response.End() is most likely what is causing that. It is because it is telling ASP.NET that the request is over.
What is the stack trace from the Exception, where does .NET think the exception is being thrown from?
You sure that doesn't happen in other code not shown ? usually you get that with when you redirect while inside a try-catch
It seems that the file is big so the IIS is killing the thread, you should change this in the web.config:
<httpRuntime
maxRequestLength="1048576"
executionTimeout="3600"
/>
maxRequestLength is in bytes
executionTimeout is in seconds
The issue is that you're calling Response.End()
before Response.Flush()
. Swap the order of those statements and the issue will go away.