how to know related method/module from browser or UI of the application in .net .

PATEL Prashant Kumar 40 Reputation points
2023-08-14T05:23:41.1266667+00:00

Hi,
Consider the below scenario.
I am the end user of an .net web based application. and i am getting an error/issue in one of the module or when clicking or accessing a particular page . and i have code base of the application as well in visual studio.

So i want to know from UI or browser of the application that when i am clicking or accessing this particular page from UI so in backend which method or are page it is calling ? and which are the related tables or stored procedure in DB ?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,815 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,598 questions
{count} votes

Accepted answer
  1. Albert Kallal 5,586 Reputation points
    2023-08-15T19:32:38.09+00:00

    As a general approach?

    Well, say we have this button on a web page, and we need to find that code?

    Well, open up the page in design mode, and simple double click on that button.

    It looks/works like this:

    So, say we open the web page ScoreCards from visual studio:

    butnav

    Is that not amazing and simple?

    This perhaps is one of the greatest features of web forms. The ability to open a UI, and click on a button to find that ONE code bit and button out of a 1000's of lines of code in a big application?

    So, we looked at the running web site, and the URL. Then opened up that page in design view. Then a simple double click on the given button, and we are jumped to code behind.

    Of course not all buttons and code will work with a simple double click as above shows. So, in above, we had a row click for the GridView. So, for that, I suggest changing the form design view to split.

    So, now first click on the gridview, and then click on the button. It looks like this:

    gvgetbut

    Once again, for a large application? Well, we are following the GUI, and thus in a way "traversing" the application right down to where we want to go.

    In above, we thus see the OnClick event. So, we can right click, and now go view code.

    Since I highlighted the onclick event, then that's in my paste buffer.

    So, the right click sequence looks like this:

    gvrob

    So, once again, we using "mostly" the GUI to navigate down to ONE bit of code, and this approach works for small, or large applications.

    Unfortunately, all too many "new" development tools have obfuscated out how a simple button or page load works, and thus it becomes progressively difficult to navigate to code like above shows with web forms.

    Regardless, with webforms you can easily drill down to one button or one bit of code, and even do so in a rather large application.

    In summary:

    Look at the URL, then open that aspx page in design mode.

    You can then simple click on the control, or even double click on a button, and you wind up in the code behind (server side code) that runs for that given button, or control.

    Often, for nested buttons (inside a gridview), then a simple click (single click) on the control in question should show up in the markup. From that you can use the 2nd approach above, and use view-code.

    That still in a rather rapid fashion gets you to code behind.

    Then ctrl-f to find. (so helps if you cut" the event for the button, then when in code behind, a ctrl-f gets yo to the code in question).

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Zhi Lv - MSFT 33,196 Reputation points Microsoft External Staff
    2023-08-15T02:06:33.2366667+00:00

    Hi @PATEL Prashant Kumar

    i want to know from UI or browser of the application that when i am clicking or accessing this particular page from UI so in backend which method or are page it is calling ?

    As AgaveJoe said, you can use the DevTools(F12) Network Tab to check the request URL, the according to the request URL and route template to find which page or method is calling.

    For example, before clicking the Privacy hyperlink, we can open the F12 Developer Tools Network Tab, then after clicking the Privacy link, it will redirect to Privacy page, since this application is an Asp.net Core MVC application, based on the route template, we can know it will access the Home controller and Privacy method.

    User's image

    Besides, you can also collect a network trace with Fiddler. More detail information, see How to collect a network trace.

    and which are the related tables or stored procedure in DB

    You can use logging. In the method of access, you can add logs about which methods is executing, which related tables or stored procedure is calling, after that you can check the log file.

    There's no built-in logging solution in ASP.NET MVC and Web API apps. Instead, most apps use third-party logging solutions like log4net, NLog, or Serilog. You can also create your own logging solution.

    In ASP.NET Core, logging is a built-in feature that can be configured and extended when the app starts up. Third-party loggers, including those mentioned above, can be integrated with ASP.NET Core to enhance its functionality.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Dillion

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.