Why am I getting the exception While executing the Server.Transfer()…
Server.Transfer(@"~/Student/StudentSendMail.aspx?username=" + username);
{Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
Best Answer
One cause of this strange error message is performing a Server.Transfer inside of a try-catch block. There are a couple of ways to handle that:
Best Answer
One cause of this strange error message is performing a Server.Transfer inside of a try-catch block. There are a couple of ways to handle that:
1) Add a second argument set to false like this:
2) Catch the Exception of type
System.Threading.ThreadAbortException
and do nothing in the catch block so the exception is ignored3) Move the Server.Transfer to the
Finally
block