473,385 Members | 1,867 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,385 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 23405
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.