If you use the Response.Redirect, or Server.Transfer method, a ThreadAbortException exception occurs. When you use try-catch statement then you will find it.
This problem occurs in above methods because both methods call Response.End internally. The Response.End method ends the execution and redirect it to the Application_EndRequest event. So the line of code that follows Response.End is not executed.
If you want to solve this problem then use Response.Redirect with endresponse parameter like Response.Redirect (“pagename”, false). so it suppress the internal call to Response.End method and for Server.Transfer, use Server.Execute method instead of Server.Transfer method.