As we know , Server.Transfer throws ThreadAbortException when executed.
Also , ThreadAbortException inherits Exception :

So why the exception wont enter the catch block in :
try
{
Server.Transfer("NoPremissionSell.aspx");
}
catch (Exception e)
{ }
while it will in :
try
{
Server.Transfer("NoPremissionSell.aspx");
}
catch (ThreadAbortException e)
{ }
edit ,
This is working in both 2 scenarios. I don’t know why it didnt work before.
please ignore.
sorry for misleading.
A number of exception types are treated differently by the .NET runtime (the Command Language Infrastructure, CLI, that underlies the execution of assemblies).
Eg.
StackOverflowExceptioncannot be caught at all by .NET code.The reason for this depends on the exception. In the case of
StackOverflowExceptionbecause the CLI cannot guarantee the correctness of the state of the process.In the case of a
ThreadAbortExceptionthe special treatment is because while it can be caught it must be re-thrown (automatically) so the thread will end.