Thread was being aborted Error ? In asp.net?

前端 未结 4 1771
失恋的感觉
失恋的感觉 2021-01-15 18:29

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

相关标签:
4条回答
  • 2021-01-15 18:37

    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?

    0 讨论(0)
  • 2021-01-15 18:41

    You sure that doesn't happen in other code not shown ? usually you get that with when you redirect while inside a try-catch

    0 讨论(0)
  • 2021-01-15 18:46

    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

    0 讨论(0)
  • 2021-01-15 18:47

    The issue is that you're calling Response.End() before Response.Flush(). Swap the order of those statements and the issue will go away.

    0 讨论(0)
提交回复
热议问题