473,659 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1676
Sounds strange, try:

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);

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 HierarchicalDat aSourceView view = base.GetData("" );
line of the following code

protected override void PerformDataBind ing()
{
HttpContext.Cur rent.Trace.Writ e("menu.cs",
"PerformDataBin ding()");
SiteMapDataSour ce dataSource = null;
HierarchicalDat aSourceView view = base.GetData("" );

HttpContext.Cur rent.Trace.Writ e("menu.cs",
"HierarchicalDa taSourceView view");
// if there's no data source don't bind
if (!base.IsBoundU singDataSourceI D && (this.DataSourc e ==
null))
return;

it calls the Initialize() method of my SqlSiteMapProvi der and the
navigation menu is updated. After this occurs it will not call my
SqlSiteMapProvi der 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 SiteSiteMapProv ider
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.Cu rrent.Session["LoadLinks"] == "Y")
{
HttpContext.Cur rent.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
2439
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 MS. Virtually every bit of the site is encapsulated within user controls. The problem begins when you try to have user controls pass information to one another as well as to their parent form. This can be accomplished by creating public...
0
1314
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 at the end of this message. The Microsoft documentation is a bit confusing to me. The following numbered sentences appear in the .NET Framework Developer's Guide article titled "Caching Portions of an ASP.NET Page": 1. You can declare an ID...
2
1256
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 fragment caching (<%@ OutputCache Duration="3600" %>) with this control, will it call the web service each time the page is requested or will it continue to use the web service data until the cache duration expires? I'd like to know as I'm trying to...
0
1454
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 image button. With caching turned on, the control remains "lame" since the control is only dynamically generated during the first access. My understanding is that page caching directive causes all page user controls to be implicitly cached as...
2
3042
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 form Main Tab Control - This contains Main Tab Pages.
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.