Easy way to debug Sharepoint web part or Event handler

I think this is worth enough to show how to debug share point controls (User control, Event hander or web part). It will reduce your time on finding out the issue.

1. First you have to build the application and put your DLL in GAC or BIN folder of your web application

2. Then you have to put that web part in share point. If it an event handler you have to register it

3. Then you have to make a break point in the code where you want to break the code for debugging(Please make sure the current version of the code and the dll you placed in BIN or GAC are same)


4. Then you have to go to DebugSelect Attach to process


5. From the next screen you have to select all the W3wp.exe process

6. Click Attach


7.. Make an IIS reset in the share point server and refresh your page where you deployed your web part.

8. Now when the web part loads you can see it is stopped on the section where we added the break point

9. Now you can debug the share point web part as normal as you debug In ASP.Net