Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What should I be doing? (XML + SQL)

Status
Not open for further replies.

Stunner01225

Technical User
Mar 13, 2002
150
GB
I I have a Treeview on a webform. The tree view is based on XML coming from SQL server 2000 and is passed through a style sheet to put it in the right format. The problem is the XML returned is bulky and time is taken up by the stylesheet’s transformation. The page takes an age to load. What I want to do is have the XML sat on the server ready transformed and ready to use. I do not know how to go about it. Using ASP.net, I can write an XML file to the server, but I do not want every user who browses the page to do this. At the same time, I do not know how to detect if the Information has changed on the Server.

What technology should I be looking at to get around this?
 
You could use the ASP.NET caching engine to achieve this. You can cache the output from a particular web form or user control at the page level and set refresh intervals based on a time periods, a parameter or a file dependency. Have a look into caching in ASP.NET, I use this for similar purposes such as XML feeds which only need to be updated periodically. The page output is cached and delivered directly wihtout processing the page and every hour a refresh of the cache is carried out to keep the syndicated content up to date.

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
Cheers, having a quick read it seems there are a few types of caching in asp which should I use? and is it the XML document that should be cached or the tree?
 
Which type of caching you use depends on your requirements. At its most simple you could just cache the webform itself by adding the following declaration under your @Page declaration
Code:
<%@ OutputCache Duration="60" VaryByParam="none"%>
The above would update the cached version of the page every 60 seconds.

If you want to do a check to see if there is any change to the XML (rather than make updating timebased) you could put the treeview control into the Cache object programatically and when the page loads check for a change. If there is one you update the cache otherwise you use it directly. As it is the transformation which is causing your lag this should solve your problem. As with everything there is lots of ways to the same end some better than others depending on what functionality you require.

Rob


Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top