473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

error on Response.End(): Unable to evaluate expression ...

tbh
in an error path in an aspx script under DotNet 2, IIS6, Win2003 Server I
get the following error (which I don't understand) on Respone.End():

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

i'm attempting to abort execution with an error and have tried for example:
System.Web.HttpResponse response =
System.Web.HttpContext.Current.Response;
response.Clear();

response.Status = "400 Bad Request";

response.End();

inside try {} catch {}. when I step through with a debugger control
transfers after response.End() to a catch clause with the exception listed
above.

any ideas what could be causing this and what I can do about it? (i'd like
to avoid 5xx errors in favor of 4xx ones when the problem is a request for
something that isn't there -- as opposed to badly broken code.)

cheers,

Tim Hanson
Feb 11 '08 #1
2 23407
Response.End(), aborts the current thread. if you call inside a try block,
you will catch the thread abort. if you use a try block, you'll need to catch
the abort and rethrow it.

-- bruce (sqlwork.com)
"tbh" wrote:
in an error path in an aspx script under DotNet 2, IIS6, Win2003 Server I
get the following error (which I don't understand) on Respone.End():

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

i'm attempting to abort execution with an error and have tried for example:
System.Web.HttpResponse response =
System.Web.HttpContext.Current.Response;
response.Clear();

response.Status = "400 Bad Request";

response.End();

inside try {} catch {}. when I step through with a debugger control
transfers after response.End() to a catch clause with the exception listed
above.

any ideas what could be causing this and what I can do about it? (i'd like
to avoid 5xx errors in favor of 4xx ones when the problem is a request for
something that isn't there -- as opposed to badly broken code.)

cheers,

Tim Hanson
Feb 11 '08 #2
tbh
thanks!

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
Response.End(), aborts the current thread. if you call inside a try block,
you will catch the thread abort. if you use a try block, you'll need to
catch
the abort and rethrow it.

-- bruce (sqlwork.com)
"tbh" wrote:
>in an error path in an aspx script under DotNet 2, IIS6, Win2003 Server I
get the following error (which I don't understand) on Respone.End():

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

i'm attempting to abort execution with an error and have tried for
example:
System.Web.HttpResponse response =
System.Web.HttpContext.Current.Response;
response.Clear();

response.Status = "400 Bad Request";

response.End();

inside try {} catch {}. when I step through with a debugger control
transfers after response.End() to a catch clause with the exception
listed
above.

any ideas what could be causing this and what I can do about it? (i'd
like
to avoid 5xx errors in favor of 4xx ones when the problem is a request
for
something that isn't there -- as opposed to badly broken code.)

cheers,

Tim Hanson

Feb 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
4
by: Zeng | last post by:
Hello, I just wonder if there is a way to programmatically evaluate expression strings such as ( ( 3 + 5 ) / 2 ) > 4 --> this should return 0 or false ( ( 3 + 6 ) / 3 ) > ( ( 5 + 3 ) / 4 ) ...
0
by: Ajit Goel | last post by:
Hi; My project file property is set to use "Visual Studio Development Server". I am able to debug and see the corresponding values when I mouseover but as soon as I change to the project file...
4
by: Glenn | last post by:
OK, I've looked up this message but am not finding how to get rid of it: "Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because...
3
by: Margie | last post by:
Working on my database I use a modified piece of code gotten from thescripts. The code works perfectly except for one thing. When entering data containing the character ' , I get the error: Syntac...
4
by: srinathvs | last post by:
Hi, I have an access db that I am trying to query from a vb6 program. I've the following code: Dim sSQLQuery As String sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID &...
16
by: jagdeep gupta | last post by:
The code was executing fine but now an exception is generated: "exc = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}" ...
9
by: jbrumbau | last post by:
Hi all, I'm having difficulty catching error 8511, which states: "Records that Microsoft Office Access was unable to paste have been inserted into a new table called 'Paste Errors' In the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.