If I remember correctly, Response.Redirect()
throws an exception to abort the current request (ThreadAbortedException
or something like that). So you might be catching that exception.
Edit:
This KB article describes this behavior (also for the Request.End()
and Server.Transfer()
methods).
For Response.Redirect()
there exists an overload:
Response.Redirect(String url, bool endResponse)
If you pass endResponse=false
, then the exception is not thrown (but the runtime will continue processing the current request).
If endResponse=true
(or if the other overload is used), the exception is thrown and the current request will immediately be terminated.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…