473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

user control caching

I have a navigation user control built using a sqlsitemap in our site's
master page. After a user logs in the control doesn't refresh the data
in the leftside navigation links. I found I can force it to refresh if
I simply resave one of the files in my project. These links then cache
after I logout until I resave a project file again.

How can I force the user control to refresh the data when a user logs
in and logs out?

Thanks,
Happy Friday,
Robert

Jan 27 '06 #1
3 1666
Sounds strange, try:

Response.Cache.SetCacheability(HttpCacheability.No Cache);

David Barkol
www.neudesic.com

Jan 27 '06 #2
I still haven't resolved this issue but I've narrowed it down to one
area of code. I turned on tracing and found that when my menu control
class gets to the HierarchicalDataSourceView view = base.GetData("");
line of the following code

protected override void PerformDataBinding()
{
HttpContext.Current.Trace.Write("menu.cs",
"PerformDataBinding()");
SiteMapDataSource dataSource = null;
HierarchicalDataSourceView view = base.GetData("");

HttpContext.Current.Trace.Write("menu.cs",
"HierarchicalDataSourceView view");
// if there's no data source don't bind
if (!base.IsBoundUsingDataSourceID && (this.DataSource ==
null))
return;

it calls the Initialize() method of my SqlSiteMapProvider and the
navigation menu is updated. After this occurs it will not call my
SqlSiteMapProvider again unless I resave a file in my project.

Why is it only calling it once? I like this caching effect only when
the user is logged in. How can I control when this SiteSiteMapProvider
is called?

Thanks,
Happy Friday,
Robert

Jan 28 '06 #3
In case anyone is interested in how I solved this... I found that
after the SiteMapProvider was called the first time it was filled with
nodes and would keep returning when it got to the following statement.

if (_root != null)
return _root;

I now control how often the database is called by creating a session
variable LoadLinks which I toggle yes/no.

public override SiteMapNode BuildSiteMap()
{

if (HttpContext.Current.Session["LoadLinks"] == "Y")
{
HttpContext.Current.Session["LoadLinks"] = "N";
Clear();
_nodes.Clear();
_root = null;
}

lock (_lock)
{
// Return immediately if this method has been called before
if (_root != null)
return _root;

Happy Thursday,
Robert

Feb 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Josh Harris | last post by:
Here is my question: It is common to have many pieces of business logic encapsulated within asp.net user controls. This can be found in high visibility projects such as the iBuySpy portal from...
0
by: Jeff Schaefer | last post by:
What I want to know is this: Is it possible to programmatically manipulate a custom property of a user control for which <%@ OutputCache ... > has been included? If so, then how? My brief code is...
2
by: Roshawn Dawson | last post by:
Hi All, I've decided to code a web user control that uses the ASP.NET Repeater control to render the output. This web user control obtains its data from a web service. If I were to use...
0
by: helveticus | last post by:
I have a master/details configuration that includes multiple user controls. The details page is configured to cache data via VaryByCustom. This works fine. One of the user controls contains an...
2
by: San24 | last post by:
Guys, Let me explain the application I have - Form > Main Tab Control > Main Tab Page > User Control > Sub Tab Control > Sub Tab Page > User Control > Contols/Text Box. Form - The main...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.