I am getting error Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
while executing line
Server.Transfer("Payment.aspx?vpc_ChannelId=2", true);
so as pointed out by this answer https://stackoverflow.com/a/1252119/1169180 & https://stackoverflow.com/a/11130517/1169180
i changed my code to
protected void Page_Load(object sender, EventArgs e)
{
try
{
UserContext conObj = new UserContext();
HttpContext CurrContext = HttpContext.Current;
if (!IsPostBack)
{
// Code
}
else
{
string userContext = hdnContextObj.Value;
conObj = JsonConvert.DeserializeObject<UserContext>(userContext);
CurrContext.Items.Add("Context", conObj);
try
{
Server.Transfer("Payment.aspx?vpc_ChannelId=2", true);
}
catch (ThreadAbortException xObj)
{
}
finally
{
Server.Transfer("Payment.aspx?vpc_ChannelId=2", true);
}
}
}
catch (Exception xObj)
{
Response.Write("Exception : " + xObj.Message);
}
}
still i am getting same exception in out catch block
Also as pointed out here http://support.microsoft.com/kb/312629/EN-US/ i used Server.Execute
but it didnt redirect to Payment.aspx
page instead it just refreshes.