Is Response.End() considered harmful?

前端 未结 9 886
陌清茗
陌清茗 2020-11-22 01:01

This KB Article says that ASP.NET\'s Response.End() aborts a thread.

Reflector shows that it looks like this:

public void End()
{
            


        
9条回答
  •  一个人的身影
    2020-11-22 01:55

    If you had employed an exception logger on your app, it will be watered down with the ThreadAbortExceptions from these benign Response.End() calls. I think this is Microsoft's way of saying "Knock it off!".

    I would only use Response.End() if there was some exceptional condition and no other action was possible. Maybe then, logging this exception might actually indicate a warning.

提交回复
热议问题