Here are a few things I believe can highly benefit to your great
project:
- Very easy: Turn .aspx pages into .ashx httphandlers when possible.
Most of your .aspx logic deals with the responses directly and does
not need to be part of a heavy .net page handler. That brings the next
point.
- Very easy: Profile your application (my favorite profiler is
http://www.jetbrains.com/profiler/, there's a free eval). You'll
immediatly realise that the previous point is critical: The useless
asp.net page logic consumes a large part of the requests cpu time
which could be easily avoided simply by turning your .aspx into ashx.
Once your done with that, I'm sure you'll find other useless hotspots.
- Easy: Introduce a couple of Provider or Strategy patterns to allow
for customization: One may for instance wish to add response caching,
rule based proxies or even static generation. All of those would
currently need to tap into your code whereas with a couple of
web.config based providers/interfaces, one could easily add their own
logic without interfering with yours.
That simply involves abstracting some entry point classes into either
abstract factories or interfaces, and replacing the current hard coded
access with singletons loaded according to their web.config settings,
while making your current implementation the default configuration.
You may look at DotNetNuke providers logic for an example.
Here are a few suggestions for entry points to provider: early in the
processing of incoming requests (to allow for early interception of
your logic with cached responses for instance), early in the
processing of outgoing requests (to allow for mangling with the proxy
for instance), for your various processors/replacers (to allow for
static generation for instance --> replace the resources' uri with
local files' uri rather than the current .aspx uris), late in the
outgoing response (to allow for late processing like caching or static
file generation).
The first and last one can also be achived with a httpmodule without
touching your code though since Asp.Net already provides that
mechanism to process requests/response before and after your code, yet
it's probably cleaned if you directly offer those entry points
-A little harder yet scalable: For string processing, either use
compiled regexes (Expresso can help a lot if you're not familiar with
regex) or XPath queries (using HtmlAgilityPack for instance) rather
than raw index based processing (cf your performance class). I'm
pretty sure you can achieve much better performances with much less
code using either of those techniques.
Ok that's quite a few suggestions already.
I'm sorry I can't help much with the code for now, but I hope I had my
explanations clear enough for consideration
Cheers