views:

314

answers:

1

I am trying to create some cached user controls. Basically Header and Footer are static.

Except the footer has one link that reads in the url of the page and puts it into the javascript for sending a link to a friend. So I need that link to be dynamic.

I set up a substitution control and had the static method return the dynamic link.

Go to run and find that substitution controls are not supported at the user control level.

Is there any work around to this? Is there another control like substitution that works on the User Controls that I am not aware of?

+1  A: 

I would forget about server side caching in this instance and rely on the simplicity of client side caching.

Your Javascript code could be client side cached just as easily as HTML, either by linking to an external javascript file and adding the necessary headers/expiries, or by embedding the script within the page itself and ensuring the page itself is cached.

Another possible method is by making an Ajax call on the page load to fetch the generated footer complete with correct link. This may take time on the first page load, but subsequent ajax requests would be cached on the client, thus seeing no penalty to future requests.

Xian