how to make code execute after Response.end

后端 未结 4 1136
感动是毒
感动是毒 2021-01-03 11:53

My code is like this

HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.ContentType = \"application/pdf\";
     HttpContext.Current.Resp         


        
4条回答
  •  有刺的猬
    2021-01-03 12:42

    HttpResponse.End (as per documentation) raises a ThreadAbortException and as you do no attempt to handle this your method exits.

    I'm not sure exactly why you must use End(), but you could put the "cleanup" code in a finally statement.

提交回复
热议问题