views:

980

answers:

4

Hi all, i am getting error

 "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."

i have redirected to a new page in repeater's itemcommand event. Error coming at line :

 string url = "~/Galleries/AlbumImageList.aspx?UId=" + this.UserId.ToString() + "&AlbumId=" + e.CommandArgument.ToString();

 Response.Redirect(url);

can anybody please help me that why is this error coming is anything wrong tere?

 _COMPlusExceptionCode is -532459699
+2  A: 

Solution: Make second argument of response.redirect(url,false);

Radhi
+2  A: 

In a bug I was investigating there was a Response.Redirect() and it was executing in an unexpected location (read: inappropriate location - inside a member property getter method).

If you're debugging a problem and experience the "Unable to evaluate expression..." exception:

  1. Perform a search for Response.Redirect() and either make the second parameter endResponse = false, or
  2. Temporarily disable the redirect call.

This was frustrating as it would appear to execute the Redirect call before the "step through" on the debugger had reached that location.

Nick Josevski
+1  A: 

I had this same problem too, and it was tricky. For me, it was because I'm using Ext.Js javascript library. If you are doing a response.redirect in server-side code that you accessed in an Ajax call, there are problems. Ext.js has a workaround with their Ext.Redirect method.

scott
+10  A: 

Hello,

Request.Redirect(url,false);

False indicate : Indicate Whether execution of current page should terminate

PrateekSaluja