Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using console.log for debugging with Classic ASP

I am looking at an a webpage written in classic ASP and I am in the middle of a 'while' statement. I want to use the Chrome Developer tools to debug the values on my page. I tried inserting

console.log(value);

which works with C# applications, but it threw a Expected end of statement at the console.log line I inserted.

I am just looking for a quick tip on how use the debugger with classic asp?

like image 481
FourHundred400 Avatar asked Sep 06 '14 00:09

FourHundred400


1 Answers

I make it by a function that returns a javascript console.log() and it works fine for me in the most used browsers (IE 10, Chrome, FireFox).

function aspLog(value)
    response.Write("<script language=javascript>console.log(`'" & value & "'`); </script>")
end function

Then, just call it in the asp page (or functions.asp file):

aspLog("Test text")
aspLog(100.0)

Unfortunately, this makes the html generated is full of javascript tags. So do not forget to comment or remove theses calls to the function aspLog() when the code is ready . If you use backticks `` you can handle inputs with both single and double quotes. Like sql queries etc.

like image 74
Edson Silva Avatar answered Sep 23 '22 10:09

Edson Silva