Ok, so is the primary difference between these two versions, is that one loops through "links.xml" and transforms each page for the whole site on the first page_load event of the first page the user hits, where as the second version transforms each page as they hit them, and you figure out which page they are on by a query string argument, right?
By the way I never found the end of the For Each loop in the first version. I also don't understand why the Function is inside the page_load event handler on the second version. Is that a VB
thing? Also, don't functions have to have arguments in VB
, so shouldn't that be a sub?
I am a bit of a "newb" to VB
so pardon my dumb questions. I have quite a bit more experience with C, C++ and now C#.
TO get back to your original question of efficiency, if I understand what you are doing correctly, I think knowing which approach is more efficient is highly depentant on your users. Loading the links.xml one time, and transforming every xml document for every page in one single page load incurs unnecessary cost if the user never visits any of those other pages, or very few of them. If the user visits most pages, or a large number of pages, then perhaps it's worth it. Without knowing more I would go for the second approach, under the assumption that you simply don't know what the average user will do and how many pages they will visit, and this spreads the cost evenly yeilding a more consistent page load time. But this is all just back-of-the-envelope conjecture so take it for what its worth.