Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > dynamic link creatation

Reply
Thread Tools

dynamic link creatation

 
 
Steve
Guest
Posts: n/a
 
      05-25-2005
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


 
Reply With Quote
 
 
 
 
garethdjames@gmail.com
Guest
Posts: n/a
 
      05-25-2005
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

 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-25-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBNVlA=?=
Guest
Posts: n/a
 
      05-25-2005
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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Map creatation program for Mac. mgrahm@trib.com HTML 15 01-07-2006 11:55 PM
Is D-Link DSL-604T same as D-Link DSL-604+ ? norm Wireless Networking 6 11-18-2005 10:25 AM
RE: Link Link Link =?Utf-8?B?REw=?= Windows 64bit 0 05-17-2005 12:15 PM
Re: Link Link Link DANGER WILL ROBINSON!!! Kevin Spencer ASP .Net 0 05-17-2005 10:41 AM
D-LINK DWL-AG650 doesn't work with WinXP - Zero Configuration Service (WZCSVC) / D-Link AirXpert nearly works Johannes Rosenstock Wireless Networking 0 08-27-2004 11:49 PM



Advertisments