State Management :: Output Cache To Be Used Only When Parameter Has Changed + Old Question Of User Control Not Answered?
Aug 26, 2010
i have 2 questions about output cache:1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :[URL]and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.
View 6 Replies
Similar Messages:
May 18, 2010
I'm trying to cache a complex page with lots of controls on it so that if the user navigates to it later it will look like it did when he last saw it.The page has controls which post back and other controls are populated depending on the selections.
I'm using [Code]....
after the <@ Page directive.
What happens is that a postback gets the cached page, so no processing and it looks the same regardless of user selections. So far so good. But if I browse to another page and return by a link, the cached version is ignored and the default page is created again. This is more or less the opposite to what i want.
I attempted to use the validation callback to ensure that a postback resulted in a new version, and that worked, but it still ignored the cached page if it wasn't a postback.I realise that it will need more work to ensure each user gets their version of the page from the cache, but why bother if this doesn't work.
View 3 Replies
Aug 27, 2010
I have set the output cache for 5 pages(5 minutes)
I want to clear all these pages from cache on some nutton click
View 2 Replies
Apr 5, 2010
I am looking for an elegant (i guess as elegant as it can be) solution to caching a users profile on login (whether it is session, cache, cookie, etc) and keeping it in sync when a users profile is changed. How do you guys handle this? Just simply call a Flush() method in your Save() method that invalidates the cache?
View 1 Replies
May 29, 2010
I want to use SQL Server based Cache dependency without data source control.How can I do it?I am binding data to grid through code.
View 5 Replies
Aug 1, 2010
I have a page that deploys a user control to display an article. The page will show a different article depending on the ID parameter fed in via querystring, and there are many thousands of articles in our db. Here is the problem: I need to cache the user control to improve performance. But editors constantly need to go in and make changes/corrections, which they want to appear instantly on the site. Is it possible to clear the cache for a specific article only once it has been edited? ie for the request article.aspx?id=123? If so how would I do this? Otherwise, if the cache is cleared for all our content every time a single piece of content is edited, it will defeat the object of caching in the first place. I have tried using a cache key as recommended here: [URL] However, this apporach suffers from the drawback mentioned above. have also seen that you can set caching up to be cleared by changes to the db. However, the particular table concerned holds content for a number of other sites and would also have the same disadvantage.
View 5 Replies
May 30, 2010
i want to save the recent state of all controls against a button1 click event. e.g. recently selected item of a dropdownlist should persist selected when user loads page next time, if he/she had clicked button1 before leaing this page. And same for allother controls on this page.
View 1 Replies
Sep 1, 2010
We have a web site that implements a custom SiteMapProvider using a User Control added in the master page. I need to be able to limit the sitemap nodes added depending on the logged in user, that is, certain users should not see certain sitemap nodes. Currently, the login processing code determines if users are in the certain category or role and then sets a value in session state, for example, Session["UserInRoleXXX"] = "Yes"; I tried changing the code in the user control to check the session state, but I got the following error: NullReferenceException ... Object reference not set to an instance of an object." Can session state be accessed in a user control?
View 6 Replies
Nov 19, 2010
I want to add a list to the cache and I would like it to stay there as long as posible.
Is there a way adding something to the cache permanently?
how do i set the exiry date of a cached object?
View 6 Replies
Mar 12, 2011
Is it possible to cache a hole site?ll its pages, images, js, db data etc...If so is it go/bad idea?
View 2 Replies
Aug 11, 2010
I have some weird problem. We're using Windows Server 2008 R2 x64 (8 Cores and
8 GB RAM) with IIS 7.5 and ASP.NET MVC 2.
I always cache (simple) stuff via the context cache and it seems like 9 out of 10 immediate page refreshs the Cache["MyKey"] is always null, even though there's no memory limit set on the pool and the server has lots of free memory.
I add expiring data via:
[Code]....
When just doing: Cache.Insert("MyKey", myObject); or Cache["MyKey"] = myObject; I get the same result (cache is almost always null for that key).
As you can see I added a callback, which writes the CacheItemRemovedReason to a text file, and the text file says CacheItemRemovedReason.Removed for MyKey. The doc for CacheItemRemovedReason.Removed says, that I call Remove/Insert on it, even though in my whole project there's no "Remove"-calls, just simple if(Cache["MyKey"] == null) {Cache["MyKey"] = ...} stuff.
I tried adding:
<caching><cache disableMemoryCollection = "true" disableExpiration = "true" privateBytesLimit="0" percentagePhysicalMemoryUsedLimit="90" privateBytesPollTime="00:02:00" /></caching>
to my web.config file in the System.Web-section but nothing changed :(
why Cache["MyKey"] is almost always null?
View 3 Replies
Jul 6, 2010
I have a treeview that shown groups and their sub groups in my usercontrol. I pass the parent GroupId to the usercpntrol from the page. I want to cache nodes of treeview for every Parent Group Id. My code is works good for first time and fill the cache object . after refresh the page, cache object fill the TreeNodeCollection succesfully and everything is ok. But after another refresh, cache object is not null but is empty and TreeNodeCollection.count is zero(0). What's my fault? Please help me to solve this problem.
[Code]....
View 5 Replies
Apr 9, 2010
Iam adding SqlCacheDependency programmatically but Iam not able to invalidate the cache.
Iam using the following Output cache directive in the .aspx page
[Code]....
The code in the .aspx.cs file is:
[Code]....
View 1 Replies
Aug 6, 2010
I have a aspx page and there is a web user control that must load dynamically with the data related to the aspx page....
ok so I want to use a querystring and pass it to the web user control.....how do I do this?
then also how do I pass a querystring from a web user control back to a aspx page?
This is a question I always had...and therefore never actually started to use the web user control
View 5 Replies
Mar 1, 2011
Since I changed from statemode"inproc" to stateserver I canīt se changes done to de session vaiable in a thread. I can only see the first value set to the session variable!
View 6 Replies
Mar 7, 2010
I've searched high and low for a efficient and reusable way to detect, on a postback/server-side, if any input controls on a form have been changed and I haven't found anything other than client-side solutions such as DirtyUpdatePanelExtender. I've come to the conclusion that it must be either really simple or really complicated.Ultimately what I want to do is to perform a database update, or not, depending on whether or not the user has changed any input controls on the form. The only thing I've come up with so far is to save the original values as Viewstate variables and then compare them with the Request values on a postback, but that seems far from ideal.
View 9 Replies
Jul 30, 2010
Is it possible to share a cache between multiple ASP.NET applications? The apps may reside on different servers. How can one achieve this requirement?
View 1 Replies
Sep 24, 2010
I know the big difference, but one thing is confusing me. Cache works only on a single machine on webfarm and to make it globally we use Velocity or memcache.So is static does same, or is it already work globally ?
eg
Cache["someid"] = "value"; //this will only work on single machine cache,
static string abc = "value"; // will this work on single machine or globally ?
View 6 Replies
Dec 12, 2010
Is it suitable to store some app settings in Application Cache? I mean settings that might need to be changed frequently...
View 1 Replies
Apr 2, 2010
I have a senario where i want to add the data into cache but only 100 records should be added.
Is their any predefined functions available.
Basically i dont want to write if else condition whiile adding the records wether its 100 records present or not.
View 1 Replies
May 9, 2010
I have a page that has a grid view.
The user selects a person from a dropdown list and then clicks a button that adds the users info as
a new row in the grid.
Adding the new row involves doing an insert and rebinding the grid which is a slow process.
How do I use the cache to see the grid update right away?
View 5 Replies
Oct 6, 2010
I wanted to know the best practice for caching data. Say I have some control example a dropdown list which is populated from my db. Now this dropdown is global and used across many pages. I was thinking of not going to database everytime to fetch data for this dropdown and put the result in Cache. And then populate this dropdown from cache. Is this a good practice or if there is another approach. Can I store my datareader in cache and then use it globally. Also could I do this in application start event?
View 4 Replies
Dec 21, 2010
asp.net.2 I am trying to update the website but the cache kips on working. How can I relies the cache on site.
View 7 Replies
Dec 9, 2010
I am Caching dataset in my application, the issue is when there is a large set of data the OutOfMemory exception is thrown.
I want to check for the this exception and when it happens I want to remove the cache object.
View 4 Replies
Sep 24, 2010
I am working with asp.net mvc and i am trying to get acces to a object that is in the cache.In the Application_Start() of Global.asax.cs i create and store an object in the cache like this:
Translator translator = new Translator();
HttpContext.Current.Cache.Insert("Translator", translator, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration);
Translator holds a dictionary with translations.Now i want acces to this object from the cache to use functions and get values from the dictionary.I know i can acces it like this HttpContext.Current.Cache.Get("Translator") or Cache.Get("Translator") in the views But how can i use the functions of the object ? The meaning of the cache is to have a object that is accesable througout the webapp right ?
Do i have to make an object and asses the value of the Cache.Get("Translator") to it, so i can use the functions or is there another solution?
View 3 Replies