.

debugging a unknown web application (c# and visual studio)

Start  by loading the web application

open the global.asax.cs file (if it exists – otherwise global.asax if exists) 
put a breakpoint on the global method, whether it is public Global() or static Global()
also put breakpoints on all the methods in this class, some includes:
protected void Application_Start(Object sender, EventArgs e)
protected void Session_Start(Object sender, EventArgs e)
protected void Application_BeginRequest(Object sender, EventArgs e)
protected void Application_EndRequest(Object sender, EventArgs e)
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
protected void Application_Error(Object sender, EventArgs e)
protected void Session_End(Object sender, EventArgs
e)
protected void Application_End(Object sender, EventArgs
e)
private void InitializeComponent()

  

next open web.config 

find the tag: <httpModules>
the modules will be specified in the following format:
<add type="bla.bla.bla.ThisModule, bla.assemblyname" name="ThisModule"/>

put breakpoints on all the module initializers – there are 2 ways of doing this:
locate all the modules  (in the individual assemblies) and put a breakpoints on the Init method
or simply search the entire solution for void Init(HttpApplication and put a breakpoint on each occurance.

then find the tag: <configSections>
the modules will be specified in the following format:
<section name="Email" type="bla.bla.bla.ProviderSectionHandler, bla.assembly" requirePermission="false"/>

open the class view – (ctrl-shift-C / view – class view)
search for the class as above: bla.bla.bla.ProviderSectionHandler
put breakpoints on any methods in this class.

find the http handlers: <httpHandlers>
find the classes (ctrl-shift-C / view – class view) for the type (e.g. whateverhandlerfactory below)
<add verb="*" path="*" type="bla.bla.bla.WhateverHandlerFactory, bla.assembly"/>

find the master page and the login page and put breakpoints on their methods.

 

run the application

trace through all the breakpoints and make notes of the order in what they happen – which method is calling which others etc.
try to get a global idea of how the architecture is structured and how it operates.

you will see that you get a good understanding of the application in no time.

 

 

What's your thoughts on this?

*

Protected by WP Anti Spam