I have started getting this error on our production web server (Windows 2003
running IIS6). I don't get the error on my Notebook (XP SP2).

The official error is "Overflow" but I have tried every variation I can
think of to ensure there is no actual overflow.

The code is as follows:

<%@ LANGUAGE="VBSCRIPT" %>
<!-- #INCLUDE FILE="../security.inc" -->
<script language="VBScript" RUNAT=SERVER>
Function CalcPremium(pState, pValue)

Select Case pState
Case "ACT", "NSW", "VIC", "TAS"
currRate = CDbl(0.0028)
currMin = 220
Case "QLD", "SA"
currRate = CDbl(0.0024)
currMin = 220
End Select

currPremium = CDbl(pValue * currRate)
If currPremium < currMin Then
currPremium = currMin
End If

CalcPremium = CLng(currPremium)

End Function
</Script>
<%
Dim currContractValue
Dim currPremium

LogVisit Session("MemberID"), "InsuranceCalc"

strMsg = ""

If Request("SubmitBack") = "Return to Insurance Page" then
Response.Redirect "construction.asp"
End If

If Not IsEmpty(Request("ContractValue")) Then
If Not IsNumeric(Request("ContractValue")) Then
currContractValue = Null
strMsg = "Please enter a number as the Contract Value"
else
currContractValue = CLng(Request("ContractValue"))
End If
else
currContractValue = Null
strMsg = "Please enter a Contract Value"
End If

If IsEmpty(Session("CalcState")) or IsNull(Session("CalcState")) Then
strState = Session("MemberState")
else
strState = Request("State")
End If
Session("CalcState") = strState

If strMsg = "" then
currPremium = CalcPremium(strState, currContractValue)
strMsg = "ContractValue = $" & currContractValue & "; State = " & strState
& "; Premium = " & FormatCurrency(currPremium,2)
End If

%>

In this version the error occures on line 15 which is:
currPremium = CDbl(pValue * currRate)

I have explicitly converted pValue to a Long and currRate to a Double.

What is also strange (apart from it working fine on my development machine),
is that it actually calculates OK every second refresh. i.e.
1. Refresh - error
2. Refresh - OK
3. Enter new value or just Submit again - error
4. Refresh - OK

Does anyone have any clues? I suspect it is a bug or setting in IIS.

--
Kevin Seerup
GoalMaker Pty Ltd
http://www.goalmaker.com

Re: VBScript runtime error '800a0006' by Anthony

Anthony
Thu Jan 25 06:12:10 CST 2007


"Kevin Seerup" <goalmaker@nospam.com> wrote in message
news:F60E6F4C-00E3-4AEC-AD7F-382BDAEF002B@microsoft.com...
> I have started getting this error on our production web server (Windows
2003
> running IIS6). I don't get the error on my Notebook (XP SP2).
>
> The official error is "Overflow" but I have tried every variation I can
> think of to ensure there is no actual overflow.
>
> The code is as follows:
>
> <%@ LANGUAGE="VBSCRIPT" %>
> <!-- #INCLUDE FILE="../security.inc" -->
> <script language="VBScript" RUNAT=SERVER>
> Function CalcPremium(pState, pValue)
>
> Select Case pState
> Case "ACT", "NSW", "VIC", "TAS"
> currRate = CDbl(0.0028)
> currMin = 220
> Case "QLD", "SA"
> currRate = CDbl(0.0024)
> currMin = 220
> End Select
>
> currPremium = CDbl(pValue * currRate)
> If currPremium < currMin Then
> currPremium = currMin
> End If
>
> CalcPremium = CLng(currPremium)
>
> End Function
> </Script>
> <%
> Dim currContractValue
> Dim currPremium
>
> LogVisit Session("MemberID"), "InsuranceCalc"
>
> strMsg = ""
>
> If Request("SubmitBack") = "Return to Insurance Page" then
> Response.Redirect "construction.asp"
> End If
>
> If Not IsEmpty(Request("ContractValue")) Then
> If Not IsNumeric(Request("ContractValue")) Then
> currContractValue = Null
> strMsg = "Please enter a number as the Contract Value"
> else
> currContractValue = CLng(Request("ContractValue"))
> End If
> else
> currContractValue = Null
> strMsg = "Please enter a Contract Value"
> End If
>
> If IsEmpty(Session("CalcState")) or IsNull(Session("CalcState")) Then
> strState = Session("MemberState")
> else
> strState = Request("State")
> End If
> Session("CalcState") = strState
>
> If strMsg = "" then
> currPremium = CalcPremium(strState, currContractValue)
> strMsg = "ContractValue = $" & currContractValue & "; State = " & strState
> & "; Premium = " & FormatCurrency(currPremium,2)
> End If
>
> %>
>
> In this version the error occures on line 15 which is:
> currPremium = CDbl(pValue * currRate)
>
> I have explicitly converted pValue to a Long and currRate to a Double.
>
> What is also strange (apart from it working fine on my development
machine),
> is that it actually calculates OK every second refresh. i.e.
> 1. Refresh - error
> 2. Refresh - OK
> 3. Enter new value or just Submit again - error
> 4. Refresh - OK
>
> Does anyone have any clues? I suspect it is a bug or setting in IIS.

It would seem that CDbl is an inappropriate data type in this case.

currRate = CCur(0.0024)

and

currPremium = CLng(pValue * currRate)

Place an Option Explicit at the top of the page.

Ensure you Dim all variables in the scope they are need e.g.:-

Function CalcPremium(pState, pValue)
Dim currPremium
Dim currRate
Dim currMin

Your function was modifying the currPremium variable which is dimmed outside
the function yet it's purpose it to return a value to be assigned to the
variable, confusing.

You have no Case Else so what happens when the state provided doesn't match
one in the Case statements?

If you are going to use prefix notations on your variables do so accurately.
Eg:-

Function CalcPremium(pState, pValue)
Dim lngPremium
Dim currRate
Dim intMin

Also for variables outside of a function use a notation indicating that it
is available globally. Eg:-

Dim glngContractValue

Using Request("fieldName") is ambigous to read. Use

Request.QueryString("fieldName")

Or

Request.Form("fieldName")

depending on whether the form Method is "GET" or "POST"

It will be interesting to see if you still have the problem having tightened
up the code in the above way.

Anthony




Re: VBScript runtime error '800a0006' by goalmaker

goalmaker
Thu Jan 25 06:34:03 CST 2007

Thanks for the advice but it still doesn't explain why it works every second
time in IIS6 and every time on my XP machine.

My previous version wasn't using a function call so the scope wasn't an
issue and I still had the same problem.

I believe using CCUR instead of CDBL would actually compound the problem
potentially rounding the calc to 2 decimal places. In any event using CDBL
would not be causing the problem.

--
Regards
Kevin Seerup

"Anthony Jones" wrote:

>
> "Kevin Seerup" <goalmaker@nospam.com> wrote in message
> news:F60E6F4C-00E3-4AEC-AD7F-382BDAEF002B@microsoft.com...
> > I have started getting this error on our production web server (Windows
> 2003
> > running IIS6). I don't get the error on my Notebook (XP SP2).
> >
> > The official error is "Overflow" but I have tried every variation I can
> > think of to ensure there is no actual overflow.
> >
> > The code is as follows:
> >
> > <%@ LANGUAGE="VBSCRIPT" %>
> > <!-- #INCLUDE FILE="../security.inc" -->
> > <script language="VBScript" RUNAT=SERVER>
> > Function CalcPremium(pState, pValue)
> >
> > Select Case pState
> > Case "ACT", "NSW", "VIC", "TAS"
> > currRate = CDbl(0.0028)
> > currMin = 220
> > Case "QLD", "SA"
> > currRate = CDbl(0.0024)
> > currMin = 220
> > End Select
> >
> > currPremium = CDbl(pValue * currRate)
> > If currPremium < currMin Then
> > currPremium = currMin
> > End If
> >
> > CalcPremium = CLng(currPremium)
> >
> > End Function
> > </Script>
> > <%
> > Dim currContractValue
> > Dim currPremium
> >
> > LogVisit Session("MemberID"), "InsuranceCalc"
> >
> > strMsg = ""
> >
> > If Request("SubmitBack") = "Return to Insurance Page" then
> > Response.Redirect "construction.asp"
> > End If
> >
> > If Not IsEmpty(Request("ContractValue")) Then
> > If Not IsNumeric(Request("ContractValue")) Then
> > currContractValue = Null
> > strMsg = "Please enter a number as the Contract Value"
> > else
> > currContractValue = CLng(Request("ContractValue"))
> > End If
> > else
> > currContractValue = Null
> > strMsg = "Please enter a Contract Value"
> > End If
> >
> > If IsEmpty(Session("CalcState")) or IsNull(Session("CalcState")) Then
> > strState = Session("MemberState")
> > else
> > strState = Request("State")
> > End If
> > Session("CalcState") = strState
> >
> > If strMsg = "" then
> > currPremium = CalcPremium(strState, currContractValue)
> > strMsg = "ContractValue = $" & currContractValue & "; State = " & strState
> > & "; Premium = " & FormatCurrency(currPremium,2)
> > End If
> >
> > %>
> >
> > In this version the error occures on line 15 which is:
> > currPremium = CDbl(pValue * currRate)
> >
> > I have explicitly converted pValue to a Long and currRate to a Double.
> >
> > What is also strange (apart from it working fine on my development
> machine),
> > is that it actually calculates OK every second refresh. i.e.
> > 1. Refresh - error
> > 2. Refresh - OK
> > 3. Enter new value or just Submit again - error
> > 4. Refresh - OK
> >
> > Does anyone have any clues? I suspect it is a bug or setting in IIS.
>
> It would seem that CDbl is an inappropriate data type in this case.
>
> currRate = CCur(0.0024)
>
> and
>
> currPremium = CLng(pValue * currRate)
>
> Place an Option Explicit at the top of the page.
>
> Ensure you Dim all variables in the scope they are need e.g.:-
>
> Function CalcPremium(pState, pValue)
> Dim currPremium
> Dim currRate
> Dim currMin
>
> Your function was modifying the currPremium variable which is dimmed outside
> the function yet it's purpose it to return a value to be assigned to the
> variable, confusing.
>
> You have no Case Else so what happens when the state provided doesn't match
> one in the Case statements?
>
> If you are going to use prefix notations on your variables do so accurately.
> Eg:-
>
> Function CalcPremium(pState, pValue)
> Dim lngPremium
> Dim currRate
> Dim intMin
>
> Also for variables outside of a function use a notation indicating that it
> is available globally. Eg:-
>
> Dim glngContractValue
>
> Using Request("fieldName") is ambigous to read. Use
>
> Request.QueryString("fieldName")
>
> Or
>
> Request.Form("fieldName")
>
> depending on whether the form Method is "GET" or "POST"
>
> It will be interesting to see if you still have the problem having tightened
> up the code in the above way.
>
> Anthony
>
>
>
>

Re: VBScript runtime error '800a0006' by Anthony

Anthony
Thu Jan 25 07:47:33 CST 2007


"Kevin Seerup" <goalmaker@nospam.com> wrote in message
news:2CED6900-BFBF-4264-94F4-12C164F6A1F0@microsoft.com...
> Thanks for the advice but it still doesn't explain why it works every
second
> time in IIS6 and every time on my XP machine.
>
> My previous version wasn't using a function call so the scope wasn't an
> issue and I still had the same problem.
>
> I believe using CCUR instead of CDBL would actually compound the problem
> potentially rounding the calc to 2 decimal places. In any event using
CDBL
> would not be causing the problem.
>

True but I find the first step to resolving such problems is to re-structure
the code into something which doesn't have other potential problems.

It's easier to look at the problem in hand if you're not distracted by other
potential problems. Eg. is there something else in the page which you
didn't post since it may not have appeared relavant that happened to Dim a
variable with the same name as on in your function? OR are we missing
something simple such as a typo because it's not exposed by having an Option
Explicit present.

Post back here code tightened up in the way I've suggested if it's still
failing. Experience tells me that it won't be. If I'm wrong we'll have a
cleaner example of the problem.






Re: VBScript runtime error '800a0006' by Bob

Bob
Thu Jan 25 08:09:08 CST 2007

Kevin Seerup wrote:
> I have started getting this error on our production web server
> (Windows 2003 running IIS6). I don't get the error on my Notebook
> (XP SP2).
>
> In this version the error occures on line 15 which is:
> currPremium = CDbl(pValue * currRate)
>
> I have explicitly converted pValue to a Long and currRate to a Double.
>
> What is also strange (apart from it working fine on my development
> machine), is that it actually calculates OK every second refresh.
> i.e.
> 1. Refresh - error
> 2. Refresh - OK
> 3. Enter new value or just Submit again - error
> 4. Refresh - OK
>
> Does anyone have any clues? I suspect it is a bug or setting in IIS.
>
> --
Look at/show us what the operands contain when the error occurs. There
is probably a clue there. Something like this (comment out the extra
statements when finished debugging):

on error resume next
currPremium = CDbl(pValue * currRate)
if err<>0 then
Response.Write "Multiplication successful"
else
Response.Write "Error was: " & err.description & "<BR>"
Response.Write "Error caused by these operands:" & _
"<BR>pValue: '" & pValue & "'<BR>" & _
"currRate: '" & currRate & "'<BR>"
end if





--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: VBScript runtime error '800a0006' by goalmaker

goalmaker
Thu Mar 01 22:27:10 CST 2007

I am sure this is a bug in IIS.

I now also get this error intermittently on certain asp pages when doing a
simple division. It is definitely not my code as it works fine in my
development environment.

The problems pretty much started after a new Web Site was installed on our
production server that was written in .asp and required framework V2 to be
installed. I was assured that asp and .asp could co-exist but now I'm not so
sure.

I have played around with the application pools (i.e. separate one for each
web site) but am still getting extremely frustrating overflow errors on
simple divisions.

I suspect I may have to wait until Microsoft admits there is a problem but
if anyone else has a workaround I would appreciate it.

Regards
--
Kevin Seerup
GoalMaker Pty Ltd
http://www.goalmaker.com


"Bob Barrows [MVP]" wrote:

> Kevin Seerup wrote:
> > I have started getting this error on our production web server
> > (Windows 2003 running IIS6). I don't get the error on my Notebook
> > (XP SP2).
> >
> > In this version the error occures on line 15 which is:
> > currPremium = CDbl(pValue * currRate)
> >
> > I have explicitly converted pValue to a Long and currRate to a Double.
> >
> > What is also strange (apart from it working fine on my development
> > machine), is that it actually calculates OK every second refresh.
> > i.e.
> > 1. Refresh - error
> > 2. Refresh - OK
> > 3. Enter new value or just Submit again - error
> > 4. Refresh - OK
> >
> > Does anyone have any clues? I suspect it is a bug or setting in IIS.
> >
> > --
> Look at/show us what the operands contain when the error occurs. There
> is probably a clue there. Something like this (comment out the extra
> statements when finished debugging):
>
> on error resume next
> currPremium = CDbl(pValue * currRate)
> if err<>0 then
> Response.Write "Multiplication successful"
> else
> Response.Write "Error was: " & err.description & "<BR>"
> Response.Write "Error caused by these operands:" & _
> "<BR>pValue: '" & pValue & "'<BR>" & _
> "currRate: '" & currRate & "'<BR>"
> end if
>
>
>
>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

Re: VBScript runtime error '800a0006' by Bob

Bob
Fri Mar 02 07:18:38 CST 2007

There are no bugs in either IIS or the scripting engine I am aware of that
involve intermittent overflow errors where no overflow should occur. I have
several classic asp and asp.net applications running side-by-side on the
same web server with none of the symptoms you describe.

However, that does not mean there isn't a bug that just hasn't hit me yet.
If there is a bug, you are going to have to help MS find it by creating a
small page that reliably repros the symptoms and sending it to MS Product
Support along with instructions as to how to reproduce the symptoms (what
inputs are required, etc.). Yes, you will have to pay for the call, but if
MS determines that the problem is a bug in their software, they will refund
the charge. I've been through this process with them and can attest to the
fact that they do not charge for bug reports.

Of course, if the problem does lie in your code, you will have paid for a
service you could have gotten from us for free. Are you sure you don't want
to provide us with a small repro page and tell us what we have to do to see
the symptoms?

Bob Barrows


Kevin Seerup wrote:
> I am sure this is a bug in IIS.
>
> I now also get this error intermittently on certain asp pages when
> doing a simple division. It is definitely not my code as it works
> fine in my development environment.
>
> The problems pretty much started after a new Web Site was installed
> on our production server that was written in .asp and required
> framework V2 to be installed. I was assured that asp and .asp could
> co-exist but now I'm not so sure.
>
> I have played around with the application pools (i.e. separate one
> for each web site) but am still getting extremely frustrating
> overflow errors on simple divisions.
>
> I suspect I may have to wait until Microsoft admits there is a
> problem but if anyone else has a workaround I would appreciate it.
>

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



Re: VBScript runtime error '800a0006' by Brian

Brian
Fri Mar 02 10:32:19 CST 2007

> I am sure this is a bug in IIS.

Kevin,

I'm willing to think the bug is not in IIS. You might find that your code is not
as bullet-proof as you think it is. For instance, I see no error checking in
your code. I'd suggest you do what Bob suggests and use ON ERROR RESUME NEXT and
then test for an error after each potential statement until you find the
problem statement and the data that its dealing with.

Ignoe the fact that "because it works on your machine, then it must be correct"
- maybe it's data related?

Brian



Re: VBScript runtime error '800a0006' by goalmaker

goalmaker
Fri Mar 02 17:30:19 CST 2007

I see no point in sending Microsoft code that I know works. i.e. it works on
my development machine and it worked on the production server prior to the
.net application being installed.

I know the code sample I supplied could be tightened up but it worked fine
until .net was installed.

I have found a number of other users reporting the same problem and the only
one that appeared to be getting close to the cause was this post:

http://www.4chapsfromblighty.com/index.php?title=problems_at_work&more=1&c=1&tb=1&pb=1

The guy rambles on a bit but at one point says "VS 2003 C++ RTL decides to
use SSE2 features of the Intel CPUs by default for the floating point
functions, if appropriate hardware is detected" and that "It quickly became
apparent that a COM object written in C++ and compiled with Visual Studio
2003 was at the root of it", which doesn't cause the .asp to fall over but
causes asp to trip up next time a calc is done.

Further on he says: "Additionally there are new floating point compiler
switches, including one to ensure the C++ code actually generates an
exception immediately an overflow occurs in the floating point functions (the
/fp:except option)."

Another post reports the same problem with a test page that gets the error
with a simple division where both variables contain 1.

In most cases the only advice was similar to what I have been given but I
know it is not my code that is at fault. I have checked the values being
calculated and the code is not the problem.

Regards
--
Kevin Seerup
GoalMaker Pty Ltd
http://www.goalmaker.com


"Brian Staff" wrote:

> > I am sure this is a bug in IIS.
>
> Kevin,
>
> I'm willing to think the bug is not in IIS. You might find that your code is not
> as bullet-proof as you think it is. For instance, I see no error checking in
> your code. I'd suggest you do what Bob suggests and use ON ERROR RESUME NEXT and
> then test for an error after each potential statement until you find the
> problem statement and the data that its dealing with.
>
> Ignoe the fact that "because it works on your machine, then it must be correct"
> - maybe it's data related?
>
> Brian
>
>
>

Re: VBScript runtime error '800a0006' by Bob

Bob
Fri Mar 02 17:56:24 CST 2007

Kevin Seerup wrote:
> I see no point in sending Microsoft code that I know works. i.e. it

That's just silly. You complain about them not doing anything about a bug
that they don't know about and about which you have no intention of telling
them. Seeya

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"