The bottom line is that the code that UAG runs is complicated. It was written and re-written over many years, and no one can be expected to just go through it in a day. The code, just like any other, goes around in loops, jumps from script to script and uses tons of variables and functions. We already mentioned the tool HTTPWatch back in Chapter 8 as a tool that can help us see what's going on. It shows the files that are being requested by the browser, and can help track them. It won't however show you files that are executed due to a server-side INCLUDE
statement. Since this tool runs on the browser, it only shows the resulting HTML content after the server-side ASP code has been already executed, without the original VBScript code, but once you know which file leads to what file, it makes it clearer to track the code itself.
To really go anywhere with all this new knowledge you now possess, you need to figure out what you want to do. If you want to change some page that UAG shows to the user (assuming, of course, that the page is supported for customization), you first need to figure out which page this is (HTTPWatch can help) and start reading the code. Often, it will contain comments that indicate what it is doing and why. As you read, try to recognize what are functions and what are commands. Make a list of variables and try to figure out what they do and what kind of data they hold. Some people can do this in their heads, and others may need a piece of paper to keep tabs on everything. Professional programmers use a "debugger", which connects to a running program and allows you to step through different commands and "freeze" at a specific command, and shows what variables exist at that point in time, and what values they hold.
Naturally, you will need to understand a lot about HTML as well, and possibly JavaScript, to really know what's going on. The code will usually be used to manipulate HTML commands. For example, a set of loops can be used to create the <TR>
and <TD>
elements of a table and populate the table with data. By examining the resulting HTML code you recorded with HTTPWatch, and reading the original code in the ASP file and its comrades, you should be able to slowly understand what's going on, and with time, carefully change the code to do what you want it to do.
The road to being able to read UAG's code is long, and to being able to change it is even longer, but you can start with the official UAG customization guide, published by Microsoft: http://technet.microsoft.com/en-us/library/ee861168.aspx