Hi guys,

long time no post, but now I'm in need of the help of this great community Wink

I have some trouble with the Cache object of ASP.Net

I have a table with several 5 rows and 5 cells in each row, each containing a link to google. (demo purposes only)

I build this table dynamically and want to cache it (for several users), instead of rebuilding it during every request.

Here is how I build the table:

HtmlTable tbl = new HtmlTable();
for (int i = 0; i < 5; i++)
{
   HtmlTableRow tblrow = new HtmlTableRow();
   for (int j = 0; j < 5; j++)
   {
      HtmlTableCell cell = new HtmlTableCell();
      HtmlAnchor href = new HtmlAnchor();
      href.InnerText = "Google.com";
      href.HRef = http://www.google.com/">http://www.google.com;
      cell.Controls.Add(href);
      tblrow.Cells.Add(cell);
   }
   tbl.Rows.Add(tblrow);
}
tbl.Border = 1;

So I add the table to the cache first and afterward to the page using the following code:

Cache.Add("object", tbl, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(2,0,0), System.Web.Caching.CacheItemPriority.Normal, null);

this.Controls.Add(tbl);

During the onLoad, I check if the object is available in the cache. If it is, I retrieve it and add it to the page, using the following code:

tbl = (HtmlTable)this.Cache["object"];

this.Controls.Add(tbl);

However, when loading the table from the cache, all HTMLAnchors inside the table are missing the href-tag.

Any ideas, why this happens? And maybe even on how to avoid it?

Thanks in Advance!

Stitch 2.0