a developer's notes – a semi-technical web development BLOG

September 5, 2011

Debugging into Classic ASP with Visual Studio

Filed under: Classic ASP — Duy Nguyen @ 2:22 pm
Tags: , , , , ,

1. First, navigate to the page your trying to debug into to load the IIS Worker Process.

2. Enable “Script source access” in IIS under the Home Directory tab. This allows VS to access the script files in ASP

3. In the Home Directory tab, click Configuration under application settings. Then click the Debugging tab. Check the box for Enable ASP server-side script debugging.

4. In Visual Studio, you need to enable Just-In-Time debugging for script files. In VS2008 go to Tools -> Options. Navigate to Debugging -> Just-In-Time. Click the check box to enable scrip debugging:

5. Add a “stop” statement to your VB code where you want the JIT debugger to break execution.

6. Finally, use the attach to process feature. In the Debug menu in VS2008. Ensure that “Attach to:” has “Script” selected and that your w3wp.exe has “Script” as one of the Types. If “Script” is not listed in the types, you have not configured IIS correctly for debugging.

7. You should now be able to navigate to the page you are trying to access. The debugger should load when the stop statement is reached and you can use the Debugging controls inside Visual Studio.

Loading XML from JavaScript

Filed under: General Tips — Duy Nguyen @ 1:25 pm
Tags: , , , ,

This was taken from: http://www.webreference.com/js/tips/020116.html

The data read from an XML file is arranged in Internet Explorer’s memory as an object, the DOMDocument object. This DOMDocument object has 35 properties, 25 methods, and 3 events. With this object, you can load XML files, navigate the document graph model, query nodes of the graph, etc. The first thing you need to do is to create an empty object.

You do it with the ActiveXObject creator:

xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");

You load an XML file with the load() method:


The following script loads an XML file and prints its content to an alert box:

  var xmldoc=new ActiveXObject("MSXML2.DOMDocument.3.0");

You can also use XPath to choose a node:


How to write to a text file with classic ASP

Filed under: Classic ASP — Duy Nguyen @ 1:20 pm
Tags: , , , ,

Here is a quick snippet on how to write to a text file with with Classic ASP. (VBscript)

dim filesys, filetxt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("c:\somefile.txt", ForAppending, True)
filetxt.WriteLine("Your text goes here.")

Can’t see XML with VBscript’s Response.Write

Filed under: Classic ASP — Duy Nguyen @ 1:16 pm
Tags: , , , ,

You won’t be able to see any text if you do this.

response.write myXml

The XML will not be displayed but it IS rendered on the page. You can do a View Source on the page to see the XML that is rendered.

Try this:

response.write "BEGIN "
response.write myXml
response.write "END"

Then in Internet Explorer, go to your page, and right-click and view Source

To run a Javascript Alert on a Classic ASP page with VBscript

Filed under: Classic ASP — Duy Nguyen @ 12:25 pm
Tags: , , ,

If you are unable to do a

response.write varableName

on your classic ASP page to output a value, try executing an alert box with Javasript. This is the code to write your script on the server side code.

Response.Write("<script language=""javascript"">" & vbCrLf)
Response.Write("<!--" & vbCrLf)
Response.Write("alert('The time at the server is: ")
Response.Write(Time() & "');" & vbCrLf)
Response.Write("//-->" & vbCrLf)
Response.Write("</script>" & vbCrLf)

Blog at WordPress.com.