Click to See Complete Forum and Search --> : does the object created in aspx page get cached?


doglin
October 25th, 2005, 07:44 PM
Hi All:
I have a quick question.
I am building a search page in ASP, now the design dilema is that i want to build a synonym hash table...

now I think it probably makes more sense if I just put the code in <%%> in the page..
or i should put it in search.aspx.cs the protected void Page_Load(object sender, EventArgs e){}

My question is if i put it in the aspx page, now does if the user press the search button every time, the page will reload, but will the hashtable object be cached or recreated each time? I would like to know if there is a way to avoid somehow cache the object rather than recreate it every single time when the user presses the "search" button.

please let me know ...many thanks

m3rlinez
October 28th, 2005, 08:59 PM
Whether you create the objects in the in-line script (<% %>) or in code-behind file, the objects you created were not cached and recreated everytime page got reloaded.

You must apply the caching manually. There is a good article here :)
http://aspnet.4guysfromrolla.com/articles/022802-1.aspx