SqlSiteMapProvider

S

SteveL

Hi,
I'm using the SqlSiteMapProvider to get my site map from sql 2005 rather
than the default web.sitemap xml file. I understand that in order to do a
cache dependency on my tables I need to ensure that the asp.net worker
process has dbo rights on my database, which I don't want to do. Therefore,
I'm not using this functionality.

My question is how can I programatically clear the sitemap cache so that the
database is re-queried depending on which user is accessing my site.

Appreciate your help.

Steve
 
S

SteveL

Thanks for the reply but unless I'm missing it somewhere this code shows you
how to use the sql dependency. It doesn't show you how to clear the cache
using code.

For example if I add this code to a button:
SqlSiteMapProvider l = new SqlSiteMapProvider();

l.OnSiteMapChanged("__SiteMapCacheDependency", null,
System.Web.Caching.CacheItemRemovedReason.DependencyChanged);

It will not clear the cached menu. Also if the item is cached different
users have different views of the menu depending on whether they are logged
in etc and this might not be as straightforward as adding a role in the
SiteMap table. The menu item might belong to lots of roles, which would
mean that the stored proc to get the sitemap might have different logic in.
Therefore, this doesn't seem very flexible as I might want to store the map
in a user session rather than an application wide cache.

Appreciate your help as I might be completely overlooking the obvious.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top