473,485 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

dynamic link creatation

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
Nov 19 '05 #1
3 1293
I would not parse the html (raw) after it was created,

Instead once the page has been rendered (use the render event),

Then loop through all controls on the page, if it is a literal control
(i.e. just text) you can then pattern match it (possibly Regex) to see
if you need to replace the text with links.

Replace any text with links (dynamically create the controls),

Finally have a look at output caching, this allows the HTML to be
cached so that you don't need to create it each time,

Hope this helps

Nov 19 '05 #2
Two suggestions:

You can use the Filter property of the HttpResponse object. This is a
Stream derived object that you can use to manipulate the outgoing response.

http://aspalliance.com/71

You can place all your "custom links" into a UserControl and set the
OutputCache on it, so it will only have to be calculated once.

bill


"Steve" <ss*@sss.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
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

Nov 19 '05 #3
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

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1713
by: Danny | last post by:
How do you guys make listings such as product listings and their detail pages more crawler friendly, if they are genrated using dynamic asp pages. If your ASP uses a format like this:...
1
2954
by: Manu | last post by:
Hello, i ve again a little problem with my dynamic web site... i need to insert a dynamic link (css) into my body ! Why ? because i've a html template and i insert into the body a dynamic...
4
4598
by: Daniel Keller | last post by:
Hello! I'm trying to set up a page system using "dynamic" SSI. That means that I normally use the following on my website: <!--#include virtual="file.inc" --> Now I want to make this...
0
2760
by: UtilityWarrior | last post by:
If you use Visual Basic 6 or VB.net and want to create PDFs from images royalty free then this DLL is for you. The Image to PDF Dynamic Link Library (DLL) will convert one or more images (JPEG,...
2
6340
by: JWL | last post by:
Hi I need to create a bunch of sites with slightly dynamic CSS. Basically, all the image paths in the CSS need to be dynamic, depending on the values of certain ASP variables. I can think of...
5
3139
by: pittendrigh | last post by:
There must be millions of dynamically generated html pages out there now, built by on-the-fly php code (and jsp, perl cgi, asp, etc). Programatic page generation is transparently useful. But...
12
9469
by: Lazoris | last post by:
OK heres a newb question and I'm sorry for it, but im getting back into web design after like 5 years off and im stuck even though i should know the problem i cant seem to correct it atm. What I'm...
2
1947
by: David W | last post by:
I need to include a style sheet link in the aspx page based on what user they are. Basically this functionality, but using code behind. Any idea how to change this line to code behind? This...
2
4426
Frinavale
by: Frinavale | last post by:
I've created a ASP.NET control that displays a "book" of schedules. It dynamically displays scheduling times and allows the user to page through the schedules. It also lets the user edit the...
0
6960
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5418
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4551
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1376
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
595
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
247
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.