Geeks With Blogs
Scott Kuhl Warning: I may have no idea what I am talking about!

I just ran into a strange problem where all the links on a list are getting dropped.  The anchor tag was still there but the href was gone.  I tracked it down to a bug in the cache.

Here is the scenario.

I am building a fairly complex bullet list in code that will change very infrequently so I cache the user control for 24 hours.  The problem is anything being built with an HtmlAnchor control is losing the Href value, but not anything else.

This breaks:

var anchor = new HtmlAnchor { HRef = "http://www.juggle.com/", InnerText = "Juggle" };

This works:

var anchor = new HtmlGenericControl("a") { InnerText = "Juggle" };
anchor.Attributes.Add("href", "
http://www.juggle.com/");

Now if I try to re-create the bug with a simple test, no luck.  It is some other deadly combination.  Maybe caching the entire UserControl?

Anyone else seen this bug?

This was the only thing I could find about it.

Problem with HTMLAnchor and ASP.Net Cache

Technorati Tags: ,
Posted on Thursday, September 4, 2008 2:28 PM | Back to top


Comments on this post: ASP.NET Cache and HtmlAnchor HRef Bug

# re: ASP.NET Cache and HtmlAnchor HRef Bug
Requesting Gravatar...
I have almost same problem.. I am using fragment caching and the HtmlAnchors inside a repeater are some times rendering proper urls based on my code and some times rendering relative urls based on the current page.. dont know why.. its weired any solution...
Left by Anz on Aug 07, 2009 1:58 AM

Your comment:
 (will show your gravatar)


Copyright © Scott Kuhl | Powered by: GeeksWithBlogs.net