c# - caching a page with data from database asp.net -


i have main page categories of items. categories of items come database. data not changes frequently. want cache page , after 1 month or so, data should updated fresh data coming db. know in asp.net there output cache , data cache.

how can achieve above functionalities?

i know there

<%@ outputcache %> 

that can used caching page.

any information provide useful me looking expert opinion.

i know it's broad topic, useful thing, should not flagged.

one of best approach can use of advanced feature of asp.net output caching sqlcachedependency class, output caching direct sql server.

you can configure sql server , asp.net cache page requests, reducing server workload, until data on page depends has been updated in sql server. sql cache dependency useful data remains comparatively static.

http://msdn.microsoft.com/en-us/library/e3w8402y(v=vs.100).aspx

you need follow steps :

first, need enable cache notification sql server, :

aspnet_regsql.exe -s <server> -u <username> -p <password> -ed -d northwind -et -t employees 

then, configure web page caching, :

<%@ outputcache duration="3600" sqldependency="northwind:employees" varybyparam="none" %> 

then, need specify caching details in web.config file, :

<!-- caching section group --> <caching>   <sqlcachedependency enabled = "true" polltime = "1000" >     <databases>       <add name="northwind"           connectionstringname="northwindconnectionstring1"          polltime = "1000"       />     </databases>   </sqlcachedependency> </caching> 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -