locked
Debugging a .Net Website RRS feed

  • Question

  • User-305496339 posted

    Hi Friends,

    I just started working on a new project where i need to debug a  website first to get a feel of how the processes flow and the accompanying data flows with it. I just have a major problem that i don't know how to debug this website that has mainly code behind in aspx files.

    Thursday, June 13, 2019 5:54 PM

Answers

  • User665608656 posted

    Hi rkrex,

    According to your requirements, I suggest that you could break each method in the code behind corresponding to your aspx page.

    Then run the project, use F10 to debug step by step, the debugging step is the process of your current project.

    Specific debugging process and information, you could refer to the following links:

    https://docs.microsoft.com/en-us/visualstudio/debugger/debugger-feature-tour?view=vs-2019

    https://docs.microsoft.com/en-us/visualstudio/debugger/quickstart-debug-with-managed?view=vs-2019

    https://docs.microsoft.com/en-us/visualstudio/debugger/walkthrough-debugging-a-web-form?view=vs-2019

    Best Regards,

    YongQing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 14, 2019 3:08 AM
  • User-1038772411 posted

    Hello rkrex,

    Please follow the below steps , It is a general way for debugging of webform

    1 ) click the left margin on the line from where you want to start debugging. A red dot appears and the text on the line is highlighted in red. The red dot represents a breakpoint. When you run the application under the debugger, the debugger will break execution at that location when the code is hit. You can then view the state of your application and debug it.For more information, see Breakpoints.

    2 ) On the Debug menu, click Start Debugging.

    3) The Debugging Not Enabled dialog box appears. Select Modify the Web.config file to enable debuggingoption, and click OK.

    4) Internet Explorer starts and displays the page that you just designed.

    In Internet Explorer, click the button.

    In Visual Studio, this takes you to the line where you set your breakpoint on the code page Default.aspx.cs or Default.aspx.vb. This line should be highlighted in yellow. You can now view the variables in your application and control its execution. Your application stops executing and waits for a command from you.

    5) On the Debug menu, click Windows, then click Watch, and then click Watch1.

    6) In the Watch window, type TextBox1.Text.

    The Watch window shows the value of the variable ex. TextBox1.Text

    7) On the Debug menu, click Step Over.

    The value of TextBox1.Text changes in the Watch window to read:

    "Button was clicked!"

    8) On the Debug menu, click Continue.

    9) In Internet Explorer, click the button again.

    Execution stops at the breakpoint again.

    10) If you click again on same line where you put debug(reddot in the left margin) .

    This removes the breakpoint.

    11) On the Debug menu, click Stop Debugging.

    For more information how to debug Asp.net or Asp.net core Apps

    Please refer this links

    https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-enable-debugging-for-aspnet-applications?view=vs-2019

    https://www.tutorialspoint.com/asp.net/asp.net_debugging.htm

    Thank You

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 14, 2019 7:52 AM

All replies

  • User665608656 posted

    Hi rkrex,

    According to your requirements, I suggest that you could break each method in the code behind corresponding to your aspx page.

    Then run the project, use F10 to debug step by step, the debugging step is the process of your current project.

    Specific debugging process and information, you could refer to the following links:

    https://docs.microsoft.com/en-us/visualstudio/debugger/debugger-feature-tour?view=vs-2019

    https://docs.microsoft.com/en-us/visualstudio/debugger/quickstart-debug-with-managed?view=vs-2019

    https://docs.microsoft.com/en-us/visualstudio/debugger/walkthrough-debugging-a-web-form?view=vs-2019

    Best Regards,

    YongQing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 14, 2019 3:08 AM
  • User-1038772411 posted

    Hello rkrex,

    Please follow the below steps , It is a general way for debugging of webform

    1 ) click the left margin on the line from where you want to start debugging. A red dot appears and the text on the line is highlighted in red. The red dot represents a breakpoint. When you run the application under the debugger, the debugger will break execution at that location when the code is hit. You can then view the state of your application and debug it.For more information, see Breakpoints.

    2 ) On the Debug menu, click Start Debugging.

    3) The Debugging Not Enabled dialog box appears. Select Modify the Web.config file to enable debuggingoption, and click OK.

    4) Internet Explorer starts and displays the page that you just designed.

    In Internet Explorer, click the button.

    In Visual Studio, this takes you to the line where you set your breakpoint on the code page Default.aspx.cs or Default.aspx.vb. This line should be highlighted in yellow. You can now view the variables in your application and control its execution. Your application stops executing and waits for a command from you.

    5) On the Debug menu, click Windows, then click Watch, and then click Watch1.

    6) In the Watch window, type TextBox1.Text.

    The Watch window shows the value of the variable ex. TextBox1.Text

    7) On the Debug menu, click Step Over.

    The value of TextBox1.Text changes in the Watch window to read:

    "Button was clicked!"

    8) On the Debug menu, click Continue.

    9) In Internet Explorer, click the button again.

    Execution stops at the breakpoint again.

    10) If you click again on same line where you put debug(reddot in the left margin) .

    This removes the breakpoint.

    11) On the Debug menu, click Stop Debugging.

    For more information how to debug Asp.net or Asp.net core Apps

    Please refer this links

    https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-enable-debugging-for-aspnet-applications?view=vs-2019

    https://www.tutorialspoint.com/asp.net/asp.net_debugging.htm

    Thank You

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 14, 2019 7:52 AM