That is an interesting way of handling this, but I am not sure I agree. You
have two suggestions thus far and I will add a third (a bit rough, perhaps,
as I did not really do any design work):
I would consider making the entire page creation dynamic rather than attempt
to loop through the "rendered" HTML. One option then is to have a program run
through each bit of output (stored in a database most likely) and add the
tags you need. The new string can be stored in another column (database) or
cached in the ASP.NET caching mechanism (done on the fly or ahead of time).
Gareth's suggestion: Loop through controls. This is possible, but it can be
problematic if you do not follow Microsoft best practices (ie, have a lot of
hybrid HTML/ASP.NET).
William's suggestion: Filter ASP.NET traffic. I like the idea of using Http
handlers or filters, etc. to control output. You can cache here, as well. The
benefit is you do not have to write the handler more than once to have every
page with links added. The only negative is the coding is a bit more complex
with you use these objects. It is worth it, however.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Steve" wrote:
Hi-
I am interested in creating links within my pages dynamically as they are
requested. For example, someone requests a page, my web app. would parse
the generated *.aspx HTML and add links to words or phrases that my app
deems appropriate.
I have tried to think of the best way to do this, the most efficient way.
It doesn't have to be done each time it's requested, I would actually prefer
if it were cached one it is done. I am trying to avoid maintaining upwards
of 100 links per page and would like to automate if possible.
I am interested in suggestions. All I have come up with is to use the Page
class to access the rendered HTML and process and modify that string. Is
this a good way to go about this?
Thank You,
Steve