473,385 Members | 1,546 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,385 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 1665
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.