Debugging a custom control from ASP.NET

I have an ASP.NET (2.0) site. I am in my dev box using V Studio 2008 and IIS. I have a separate User Control project that is called from a javascript function in the default.aspx page. The User Control project is in a different solution.

The app works as expected. User control is invoked and all is well. Well, not quite.

I am unable to enter the User Control project, i.e. debug it. I can set breakpoints, but they never fall into the trap. I can debug all other areas of the site both in script and code without any problem. The custom control is created in DEBUG in the same location as the default.aspx page.

Things I've already tried: Enabled script debugging in IE. Added User Control project to the same website solution Debugger disabled to launch IE instance from Visual Studio Debug enabled on site. Created a custom control in debug mode and ensured pdb is in the same directory

Below is some sample code that should help:

default.aspx: (Shorthand for brevity)

                                       

      function LoadMethod () {try {LoadControl.Ping ();

        }
        catch (e) //if the DLL didn't run assume there is a trust problem.
        {    
        }
    }

      

When I go to the LoadControl.Ping call, the debugger just steps over that line of code.

Please only give feedback if you actually did it in practice.

0


source to share


2 answers


  • Add a user management project to the solution you want to debug.
  • Remove the link you are using for the user management project
  • Then set the reference of the calling project as a local user control project


Edit: You may also need to do a cleanup after deleting the link in the second step and then check that there is no copy of the custom dashboard in your bin

+1


source


This is an old question, but still googles, so here's something that might help. This post talks about DotNetNuke modules, but I think the concept is what you were talking about - a main web project with secondary web projects that contain custom controls.



Something in the blog post is not mentioned: Once you've configured your project to use IIS rather than webdevwebserver and set the override url, you sometimes have to do something extra to debug things. Right click on the project -> Debug -> Start New Instance. This seems to be the only way I can reliably debug one of our usercontrol projects. Keep in mind that this project is being pulled by legs and shouts from 1.1 to 3.5, so it is probably unhappy with a few other things :-)

0


source







All Articles