How to debug custom application pages in Sharepoint

By Namwar Rizvi - Last updated: Friday, January 9, 2009 - Save & Share - 5 Comments

To debug your custom application pages located in layouts folder, perform the following steps:

  1. In IIS, select your web application and from context menu, select Open. It will display the directory in windows explorer
  2. Edit Web.config in any text editor (e.g. Notepad)
  3. In web.config, search for compilation node like “<compilation batch=”
  4. To enable debugging, update the node as follows
    • Set batch=false
    • Set debug=true
  5. After update, your compilation node will become <!– /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:””; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:”Times New Roman”; mso-fareast-font-family:”Times New Roman”;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} –>

    <compilation batch=false debug=false>

  6. Launch Internet Explorer and browse your custom application page
  7. Now, launch Visual Studio and open your Custom Application Page from layouts directory
  8. Go to Debug->Attach To Process and attach to w3wp.exe
  9. attachtoprocess1
    attachtoprocess2

  10. Add break points as necessary.
  11. In Internet Explorer, refresh your page and bingo! you can debug your custom application page now.
Share
Posted in Debugging • • Top Of Page

5 Responses to “How to debug custom application pages in Sharepoint”

Comment from Sushil
Time April 22, 2009 at 9:41 am

Thanks a lot

Comment from Sushil Kr Maurya
Time April 22, 2009 at 9:41 am

Many Many Thank you

Comment from Sushil Kr Maurya
Time April 22, 2009 at 9:42 am

Thanks

Comment from Sushil Kr Maurya1
Time April 22, 2009 at 9:43 am

thanksssssss

Comment from Sushil Kr Maurya
Time April 22, 2009 at 9:44 am

Thank you… You are gr8. I am big fan of you. 🙂

Write a comment