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.

Advertisements

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.")
filetxt.Close 

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)

September 2, 2011

Skipping Assembly Strong Name Validation

You can disable strong name valildation on an assembly using the Strong Name tool that comes with Visual Studio.

Open the Visual Studio Command Prompt. This should be available on Start, All Program Files, Visual Studio 200x, Visual Studio Tools.

At the command prompt:
SN -Vr “c:\location of the assembly\myassembly.dll”

To re-enable verification:

SN -Vu “c:\location of the assembly\myassembly.dll”

Blog at WordPress.com.