How do you debug classic ASP?

From an MSDN blog post: http://blogs.msdn.com/mikhailarkhipov/archive/2005/06/24/432308.aspx Here is how to make ASP debugging work: Enable ASP debugging on the server. (I also added DEBUG verb to the asp extension, but I am not sure if it is required). Open classic ASP in VS 2005. Set breakpoint. View page in browser or run without debugging. Debug … Read more

What does (?: do in a regular expression

(?:) creates a non-capturing group. It groups things together without creating a backreference. A backreference is a part you can refer to in the expression or a possible replacement (by saying \1 or $1 etc – depending on flavor). You can also extract them from a match afterwards when using regex in a programming language. … Read more

How to do a single line If statement in VBScript for Classic-ASP?

The conditional ternary operator doesn’t exist out of the box, but it’s pretty easy to create your own version in VBScript: Function IIf(bClause, sTrue, sFalse) If CBool(bClause) Then IIf = sTrue Else IIf = sFalse End If End Function You can then use this, as per your example: lunchLocation = IIf(dayOfTheWeek = “Tuesday”, “Fuddruckers”, “Food … Read more

Is it better to log to file or database?

Edit In hindsight, a better answer is to log to BOTH file system (first, immediately) and then to a centralized database (even if delayed). Most modern logging frameworks follow a publish-subscribe model (often called logging sources and sinks) which will allow multiple logging sinks (targets) to be defined. The rationale behind writing to file system … Read more

Is try-catch like error handling possible in ASP Classic?

There are two approaches, you can code in JScript or VBScript which do have the construct or you can fudge it in your code. Using JScript you’d use the following type of construct: <script language=”jscript” runat=”server”> try { tryStatements } catch(exception) { catchStatements } finally { finallyStatements } </script> In your ASP code you fudge … Read more

Can someone explain this SQL injection attack to me?

Just formatting it for readability will clarify a lot: set ansi_warnings off DECLARE @T VARCHAR(255), @C VARCHAR(255) DECLARE Table_Cursor CURSOR FOR select c.TABLE_NAME, c.COLUMN_NAME from INFORMATION_SCHEMA.columns c, INFORMATION_SCHEMA.tables t where c.DATA_TYPE in (‘nvarchar’,’varchar’,’ntext’,’text’) and c.CHARACTER_MAXIMUM_LENGTH > 30 and t.table_name = c.table_name and t.table_type=”BASE TABLE” OPEN Table_Cursor FETCH NEXT FROM Table_Cursor INTO @T, @C WHILE(@@FETCH_STATUS=0) BEGIN … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)