SirReadAlot
asked on
Debugging Classic ASP Code
Hi guys,
I saw this nice article...and I would like to debug asp code in 2005.
I read this article and I am not too sure about step 2.
can you explain?
http://blogs.msdn.com/greggm/archive/2006/03/15/552108.aspx
thanks
I saw this nice article...and I would like to debug asp code in 2005.
I read this article and I am not too sure about step 2.
can you explain?
http://blogs.msdn.com/greggm/archive/2006/03/15/552108.aspx
thanks
ASKER
yes done that i don't understand step 2
ASKER
this
#2. Since the debugger doesn’t have support for ASP Auto-Attach, you can’t just press F5. But what you can do is to hit your page in IE, and use the below macro to automatically start debugging the ASP code. You can assign a macro to a key, so within 2 minutes, you can have Ctrl-Shift-F5 (or whatever key you want), setup to automatically attach to the worker process and get a pretty similar experience to what you have always had.
Sub ClassicASPAttach()
Try
Dim os As System.Version = System.Environment.OSVersi on.Version
Dim IISProcess As String = "w3wp.exe"
If os.Major = 5 And os.Minor < 2 Then
IISProcess = "dllhost.exe"
End If
Dim processFound As Boolean = False
Dim process As EnvDTE80.Process2
For Each process In DTE.Debugger.LocalProcesse s
'Determine if the process could the IIS worker process
Dim processName As String = process.Name.ToLowerInvari ant()
Dim processBaseName As String = System.IO.Path.GetFileName (processNa me)
If Not processBaseName = IISProcess Then
If Not processBaseName = "inetinfo.exe" Then
Continue For
End If
End If
'Determine if the process contains asp.dll
Dim aspLoaded As Boolean = False
Dim diagProcess As System.Diagnostics.Process = System.Diagnostics.Process .GetProces sById(proc ess.Proces sID)
Dim diagModule As System.Diagnostics.Process Module
For Each diagModule In diagProcess.Modules
Dim moduleName As String = System.IO.Path.GetFileName (diagModul e.FileName ).ToLowerI nvariant()
If moduleName = "asp.dll" Then
aspLoaded = True
Exit For
End If
Next
'If the process contains asp.dll, attach to it
If aspLoaded Then
process.Attach2("Script")
processFound = True
End If
Next
If Not processFound Then
MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
#2. Since the debugger doesn’t have support for ASP Auto-Attach, you can’t just press F5. But what you can do is to hit your page in IE, and use the below macro to automatically start debugging the ASP code. You can assign a macro to a key, so within 2 minutes, you can have Ctrl-Shift-F5 (or whatever key you want), setup to automatically attach to the worker process and get a pretty similar experience to what you have always had.
Sub ClassicASPAttach()
Try
Dim os As System.Version = System.Environment.OSVersi
Dim IISProcess As String = "w3wp.exe"
If os.Major = 5 And os.Minor < 2 Then
IISProcess = "dllhost.exe"
End If
Dim processFound As Boolean = False
Dim process As EnvDTE80.Process2
For Each process In DTE.Debugger.LocalProcesse
'Determine if the process could the IIS worker process
Dim processName As String = process.Name.ToLowerInvari
Dim processBaseName As String = System.IO.Path.GetFileName
If Not processBaseName = IISProcess Then
If Not processBaseName = "inetinfo.exe" Then
Continue For
End If
End If
'Determine if the process contains asp.dll
Dim aspLoaded As Boolean = False
Dim diagProcess As System.Diagnostics.Process
Dim diagModule As System.Diagnostics.Process
For Each diagModule In diagProcess.Modules
Dim moduleName As String = System.IO.Path.GetFileName
If moduleName = "asp.dll" Then
aspLoaded = True
Exit For
End If
Next
'If the process contains asp.dll, attach to it
If aspLoaded Then
process.Attach2("Script")
processFound = True
End If
Next
If Not processFound Then
MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
will try this
thanks
thanks
Can u help me setup this in visual studio 2005.
Do I need both functions:
Sub ClassicASPAttach()
Try
Dim os As System.Version = System.Environment.OSVersi on.Version
Dim IISProcess As String = "w3wp.exe"
If os.Major = 5 And os.Minor < 2 Then
IISProcess = "dllhost.exe"
End If
Dim processFound As Boolean = False
Dim process As EnvDTE80.Process2
For Each process In DTE.Debugger.LocalProcesse s
'Determine if the process could the IIS worker process
Dim processName As String = process.Name.ToLowerInvari ant()
Dim processBaseName As String = System.IO.Path.GetFileName (processNa me)
If Not processBaseName = IISProcess Then
If Not processBaseName = "inetinfo.exe" Then
Continue For
End If
End If
'Determine if the process contains asp.dll
Dim aspLoaded As Boolean = False
Dim diagProcess As System.Diagnostics.Process = System.Diagnostics.Process .GetProces sById(proc ess.Proces sID)
Dim diagModule As System.Diagnostics.Process Module
For Each diagModule In diagProcess.Modules
Dim moduleName As String = System.IO.Path.GetFileName (diagModul e.FileName ).ToLowerI nvariant()
If moduleName = "asp.dll" Then
aspLoaded = True
Exit For
End If
Next
'If the process contains asp.dll, attach to it
If aspLoaded Then
process.Attach2("Script")
processFound = True
End If
Next
If Not processFound Then
MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Sub ClassicASPDetach()
Try
Dim os As System.Version = System.Environment.OSVersi on.Version
Dim IISProcess As String = "w3wp.exe"
If os.Major = 5 And os.Minor < 2 Then
IISProcess = "dllhost.exe"
End If
Dim processFound As Boolean = False
Dim process As EnvDTE80.Process2
For Each process In DTE.Debugger.LocalProcesse s
'Determine if the process could the IIS worker process
Dim processName As String = process.Name.ToLowerInvari ant()
Dim processBaseName As String = System.IO.Path.GetFileName (processNa me)
If Not processBaseName = IISProcess Then
If Not processBaseName = "inetinfo.exe" Then
Continue For
End If
End If
'Determine if the process contains asp.dll
Dim aspLoaded As Boolean = False
Dim diagProcess As System.Diagnostics.Process = System.Diagnostics.Process .GetProces sById(proc ess.Proces sID)
Dim diagModule As System.Diagnostics.Process Module
For Each diagModule In diagProcess.Modules
Dim moduleName As String = System.IO.Path.GetFileName (diagModul e.FileName ).ToLowerI nvariant()
If moduleName = "asp.dll" Then
aspLoaded = True
Exit For
End If
Next
'If the process contains asp.dll, attach to it
If aspLoaded Then
process.Detach(False)
processFound = True
End If
Next
If Not processFound Then
MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Sub ClassicASPAttach()
Try
Dim os As System.Version = System.Environment.OSVersi
Dim IISProcess As String = "w3wp.exe"
If os.Major = 5 And os.Minor < 2 Then
IISProcess = "dllhost.exe"
End If
Dim processFound As Boolean = False
Dim process As EnvDTE80.Process2
For Each process In DTE.Debugger.LocalProcesse
'Determine if the process could the IIS worker process
Dim processName As String = process.Name.ToLowerInvari
Dim processBaseName As String = System.IO.Path.GetFileName
If Not processBaseName = IISProcess Then
If Not processBaseName = "inetinfo.exe" Then
Continue For
End If
End If
'Determine if the process contains asp.dll
Dim aspLoaded As Boolean = False
Dim diagProcess As System.Diagnostics.Process
Dim diagModule As System.Diagnostics.Process
For Each diagModule In diagProcess.Modules
Dim moduleName As String = System.IO.Path.GetFileName
If moduleName = "asp.dll" Then
aspLoaded = True
Exit For
End If
Next
'If the process contains asp.dll, attach to it
If aspLoaded Then
process.Attach2("Script")
processFound = True
End If
Next
If Not processFound Then
MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Sub ClassicASPDetach()
Try
Dim os As System.Version = System.Environment.OSVersi
Dim IISProcess As String = "w3wp.exe"
If os.Major = 5 And os.Minor < 2 Then
IISProcess = "dllhost.exe"
End If
Dim processFound As Boolean = False
Dim process As EnvDTE80.Process2
For Each process In DTE.Debugger.LocalProcesse
'Determine if the process could the IIS worker process
Dim processName As String = process.Name.ToLowerInvari
Dim processBaseName As String = System.IO.Path.GetFileName
If Not processBaseName = IISProcess Then
If Not processBaseName = "inetinfo.exe" Then
Continue For
End If
End If
'Determine if the process contains asp.dll
Dim aspLoaded As Boolean = False
Dim diagProcess As System.Diagnostics.Process
Dim diagModule As System.Diagnostics.Process
For Each diagModule In diagProcess.Modules
Dim moduleName As String = System.IO.Path.GetFileName
If moduleName = "asp.dll" Then
aspLoaded = True
Exit For
End If
Next
'If the process contains asp.dll, attach to it
If aspLoaded Then
process.Detach(False)
processFound = True
End If
Next
If Not processFound Then
MsgBox("Could not find this IIS process. Hit a web page containing classic ASP script so that the process will start.")
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Reopen question.
Right click on your web site and select Properties -> Home Directory -> Configuration -> Debugging tab.
--Nauman.