I\'m trying to diagnose a problem with a site that seems to be throwing an error in the code somewhere. From the error logs it seems be an SQL syntax error caused by bad con
Generally you set "on error resume next", then check for the error code "Err.Number" after the offending line of code for non-zero values.
See: http://www.powerasp.com/content/new/on-error-resume-next.asp
You can get good, but not great info from ASP when you have an error.
But you can define a custom 500 error code page in ASP land that can give you a bit more info when your program crashes. Here's some sample code that will build a pretty decent error message about your error.
Set objASPError = Server.GetLastError
Dim strProblem
strProblem = "ASPCode: " & Server.HTMLEncode(objASPError.ASPCode) & vbCrLf
strProblem = strProblem & "Number: 0x" & Hex(objASPError.Number) & vbCrLf
strProblem = strProblem & "Source: [" & Server.HTMLEncode(objASPError.Source) & "]" & vbCrLf
strProblem = strProblem & "Category: " & Server.HTMLEncode(objASPError.Category) & vbCrLf
strProblem = strProblem & "File: " & Server.HTMLEncode(objASPError.File) & vbCrLf
strProblem = strProblem & "Line: " & CStr(objASPError.Line) & vbCrLf
strProblem = strProblem & "Column: " & CStr(objASPError.Column) & vbCrLf
strProblem = strProblem & "Description: " & Server.HTMLEncode(objASPError.Description) & vbCrLf
strProblem = strProblem & "ASP Description: " & Server.HTMLEncode(objASPError.ASPDescription) & vbCrLf
strProblem = strProblem & "Server Variables: " & vbCrLf & Server.HTMLEncode(Request.ServerVariables("ALL_HTTP")) & vbCrLf
strProblem = strProblem & "QueryString: " & Server.HTMLEncode(Request.QueryString) & vbCrLf
strProblem = strProblem & "URL: " & Server.HTMLEncode(Request.ServerVariables("URL")) & vbCrLf
strProblem = strProblem & "Content Type: " & Server.HTMLEncode(Request.ServerVariables("CONTENT_TYPE")) & vbCrLf
strProblem = strProblem & "Content Length: " & Server.HTMLEncode(Request.ServerVariables("CONTENT_LENGTH")) & vbCrLf
strProblem = strProblem & "Local Addr: " & Server.HTMLEncode(Request.ServerVariables("LOCAL_ADDR")) & vbCrLf
strProblem = strProblem & "Remote Addr: " & Server.HTMLEncode(Request.ServerVariables("LOCAL_ADDR")) & vbCrLf
strProblem = strProblem & "Time: " & Now & vbCrLf
Edit On IIS7 GetLastError doesn't seem to have any info available.
You can workaround the problem by creating a 500.100 and point this at your script.
YMMV, check these URLS for more info http://forums.iis.net/t/1150502.aspx and http://www.tacticaltechnique.com/web-development/classic-asp-getlasterror-in-iis7/