When am I able to access the ASPError object? - asp-classic

I've begun using ASPUnit to unit test my classic ASP code. This is all good and I'm happy. The only problem is with the error messages it displays when a test generates a runtime error. For example, if I've not defined a variable somewhere in my function I get the error:
Microsoft VBScript runtime error (500): Variable is undefined
What would be more useful is if it could tell me which file/line the error occurred on. I know that I can get this information from the ASPError object which is returned by the Server.GetLastError() and elsewhere in my project I have a custom 500 error page which makes use of this method to automatically report crashes to Fogbugz. However when I try to access Server.GetLastError anywhere else the information returned is blank. For example, the following code will output zero rather than the expected 4.
<%
Option Explicit
On Error Resume Next
aVariable = "hello"
Dim errObj : Set errObj = Server.GetLastError()
Response.Write errObj.Line
%>
Is this the correct way to access ASPError or is it only possible on custom error pages? Is there a better way to get error messages reported within ASPUnit?

To the best of my knowledge the ASPError object does not get populated until your current page finished processing. Its meant to only be used on the 500 error page only. So theory is when you get an error if you've set up your 500 page then IIS will do an internal redirect to that page to allow you to at least record the error. Then and only then is the ASPError object available. I've had crazy ideas of using a xmlhttprequest to try to grab the page but thats just not the way it works.
In short there is not much you can do to get that error message details that you want.
Using JScript server side you can use try catch's which give you access to a exception object but even thats not much good to you, no line numbers or anything. Rubbish.

Related

Button with correct signature not found in type

I keep getting this "correct signature not found in type error" when adding a button. I've tried every variation of the signature that I can think of to no avail. I think the issue may have something to do with the other errors. Do the errors come from using Drive to store the files? view Code behind Errors

What causes "ASP 0248" error?

I get this really bizarre error:
0x80004005 - Object ObjectContext: 006~ASP 0248~Script isn't transacted. This ASP file must be transacted in order to use the ObjectContext object.
In some cases. I have old ASP pages that call several libraries, one of which does this:
IF blnHasError THEN
ObjectContext.SetAbort
ELSE
ObjectContext.SetComplete
END IF
Which is where the error occurs. But given the obscure error message, I can't figure out what ASP wants or expects.
The calling page must be transacted, meaning that in its header it must declare this:
<%# Transaction=Required %>
More documentation here.

When is System.Convert.FromBase64String() implicitly called?

I'm getting an Invalid length for a Base-64 char array error, but it's not my code and I don't see any explict references to this function. I know that it could be a problem with the ViewState or a '+' decoding problem with Request.QueryString, but is there anything else where something is being implicitly converted to Base 64?
Edit: I'm just given a bunch of code and an exception message pointing to some pages, so I'm looking for absolutely anything related that could be suspicious - but I don't know what those look like. No debug privilages either so I have to just scan through and make guesses.
You need to use the debugger to find out exactly which line is causing the error. You can find this out by having the debugger break whenever an exception is thrown in your code. Do the following within Visual Studio (I am showing Visual Studio 2012):
Click the Debug menu.
Choose Exceptions...
You will now see the following:
As the picture shows, make sure the Thrown checkbox is checked for Common Language Runtime Exceptions.
Click OK and the next time you run your code, the debugger should halt at the line that is causing the Invalid length for a Base-64 char array error.

Actionscript error

I have a flex application which is configured with blazeds sever and i am pulling images from remote database from my flex application, but as soon as i click the get image button to pull images it is giving some action script error.
TypeError: Error #2007: Parameter bytes must be non-null.
at flash.display::Loader/_loadBytes()
at flash.display::Loader/loadBytes()
I tried googling but couldn't found any solution.
Any help is appreciated.
You have a null parameter inside the function flash.display::Loader/loadBytes(). ;)
Short answer is that you're probably fetching the wrong url. Use firebug or Fiddler or something to determine whether the url is correct. If that's not the case, maybe you're not handling the right events.
Like the comments say, we need the code.
Thank You everyone it was a my code error, it give this error if no value is returned to load bytes . I was pulling a image from a table where no image was present and therefore returning null value in load bytes.

No clue.. Overflow, Microsoft VBScript runtime error '800a0006'

I'm receiving suddenly this error on a Win2003 Server Web Application:
Microsoft VBScript runtime error '800a0006'
Overflow: 'Appname'
A bunch of updates where performed on this server but I have rolled them back all.
The page is old ASP code and if i run file monitor utility it will show the BUFFER OVERFLOW when it hits a GIF.
Any ideas?
Microsoft VBScript runtime error '800a0006' almost always indicates a divide by zero error.
You can reproduce the Overflow error like this :
Dim testVar
testVar = 99999
testVar = CInt(testVar)
So, maybe this indicates there are some problems with the data types where you are setting some variables on that file?
Can you figure out where in the file the error is happening? You can use
Response.Write "here"
Response.End
And then load the page to see what point it gets to. Then you can post the code that is crashing and we may be able to help you more.
You may have a function with Out of Range variable
If you used integer variable and the variable posses greater than
integer range then its shows error.
Explanation:
Dim IntVar AS Integer
IntVar = 50000
Then it must show overflow error
So you can use following code instead of given code
Dim LongVar As Long
longVar = 50000

Resources