Attaching to Processes
At some point you might need to attach to a process running somewhere on the computer and debug it from within the ASP.NET page. This could be the ASP.NET process, aspnet_wp.exe, or another running service, or any other program running on the server. This can be accomplished quite easily.
Under the Debug menu you will find the Processes selection. Clicking this brings up the dialog box in Figure 7.6.
Figure 7.6 Attaching to a running process.
By default, you will see only the processes that you have started in some way. If you click the Show System Processes check box, you have access to everything that is running on the current machine. Click the process to be debugged, and then click the Attach button. Now, if that process hits a breakpoint or any other type of debugger event, that event pops up in the Visual Studio .NET IDE. You can also force the program to break by clicking the Break button at the bottom of the window. At any time, you can stop debugging the process by clicking the Detach button. Terminate kills the process altogether.
After clicking the Attach button, you are given a choice of what type of debugging you want to do on the process you've selected. Figure 7.7 shows an example of this dialog box.
Figure 7.7 Choosing the debug type.