C# - Browser Cache Clearable Via Code?
Sep 18, 2010
I have a menu on my site that changes depending on whether the user is logged in or not. With browser caching, the menu "gets stuck" in either state and is confusing to users.They'll login, but the menu won't update because it's still cached in the unauthenticated state... and vice versa.How is this typically handled? Can we refresh the user's browser cache from our code? Or do I just not allow browser caching? (would rather use it, very nice bump in speed).UpdateHere's how I set client-side, browser caching in my asp.net mvc 2 app:
public class CacheFilterAttribute : ActionFilterAttribute {
/// <summary>
/// Gets or sets the cache duration in seconds. The default is 10 seconds.
[code]...
View 2 Replies
Similar Messages:
Dec 16, 2010
In my site i m redirecting to login page when i m clicking on loguot button. before that i have written follwing code for clearing cache/history-
Session.Clear();
Session.Abandon();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
but when i m pasting previous page url in address bar then it is showing that page. i dont want to show that page.
View 5 Replies
Oct 13, 2010
I have issue about multiple login in asp.net.
Case this happen:
User X login as "user1" in web browser.
Then user Y also login as "user1" also in another web browser.
User Y got error message "Another user log in some account".
That is work as expected.
If X, close their web browser. Then try again to login in as "user1".
X get also get "Another user log in some account".
So i trying debug then i found session is remove when web browser is close, but cache still remaining in web browser.
how to clear cache when user close their browser, (not tab).
View 1 Replies
Jan 24, 2011
If i enable client side cache in my asp.net application where it store that cache controls in my computer
View 1 Replies
Aug 19, 2010
i am using ScriptManager in my webpage. i am also using a lot of pagemethods in this page. When i look at the viewsource of the browser after the page has been rendered i find a lot of javascript which has been generated by the scriptmanager.
how can i browser cache all these scripts so that they are not loaded everytime the page is rendered.
View 2 Replies
Jan 11, 2010
Not sure if i'm posting in the right forum, if not, please move it...i have the following issue... I want to "disable" browser's back button. Seems it's not possible, but using cache.setcacheability and timing it, kinda disables the option of navigating back. I need this because in some pages of my webpage, i keep values in a Session variable so when a page loads, i need to check that variable, and, if navigating back, cant do that. I also "set cache to false" because if someone closes session, and i allow cache, someone else could handtype a url in that same pc and see the page without login (though if he/she tries to navigate through it will be kicked out because when loading a new page, i'll know that he/she is not logged) but i dont want to allow even that,
that's why cache is disabled. The problem is that loading over and over again my masterpage (header, footer, menu and stuff) is going to slow down the webpage, because every time there's a request, the page has to be sent again completely. So, is there something like a "mix" mode where i can allow cache just for a few things? If not, what's the best practice to achieve both things i'm trying: speed and security?
View 4 Replies
Jan 22, 2011
i am using Jcrop to give users the option to crop there images, i have hit a small caching problem.
if you open an image which is already on the server and crop it. my jcrop works and crops the image fine but when i reload the image the old version is displayed. i have this inside an update panel.
so is there a way of removing the browsers cache before i reload the image?
View 5 Replies
Apr 19, 2010
As part of the deployment, we need to have a maintenance page displayed for our web site. The issue we are experiencing is that when the maintenance page is active and ISA rule is configured to redirect to the maintenance page. We see the following behavior:
The user is not displayed the maintenance page, but is displayed a splash page with the English and French buttons. Click on any button displayed a 404 error regarding the URL / File not found. After clearing the local cache and reloading the browser, the maintenance page is displayed successfully.
The same behavior is noticed one we have disabled the ISA rule for the maintenance page and re-enabled the ISA rule for the the Website. The user is presented with the 404 error and once the cache is deleted, the user can see the Website.The issue is a cause by browser retrieving the website pages from the cache and not directly from the webserver.
View 1 Replies
Jun 14, 2010
I have a form that has n dropdownlists, and the form has gotten so big that it now weights over 1.2MB...I was wondering, is it possible to load the datasource items once in the browser and have all related dropdownlist use that single datasource to conserve bandwidth?Something like, load datasource into div, and on page_load have all dropdownlist load from that div...
View 1 Replies
Jun 28, 2010
how to remove css,java script file from browser cache for IE6 and IE7 ?
View 4 Replies
May 7, 2015
I am inserting and updating the image from html file upload to my gridview / insertion goes fine , but when i update the image by clicking on edit using onselectedindexchanged event of gridview, I fetch the image then change it with other image, with this simultaneously i rebind the gridview, in the beck-end everything goes fine it updates and replaces the image but in gridview it won't show after updated. I am using postbacktrigger on my submit button, but gridview won't refreshes, until and unless i click on address bar and press ENTER , or until i won't press CTRL+F5 to clear the browser cache.
View 1 Replies
May 15, 2010
I am using Html.RenderAction<CartController>(c => c.Show()); on my master Page to display the cart for all pages. The problem is when I add an item to the cart and then hit the browser back button. It shows the old cart (from Cache) until I hit the refresh button or navigate to another page.
I've tried this and it works perfectly but it disables the Cache globally for the whole page an for all pages in my site (since this Action method is used on the master page). I need to enable cache for several other partial views (action methods) for performance reasons.
I wouldn't like to use client side script with AJAX to refresh the cart (and login view) on page load - but that's the only solution I can think of right now.
View 1 Replies
Apr 22, 2010
I have an external javascript file which I include to my page on the code behind (as seen below).
My problem is, when I my page makes a postback (not partial one), I check the loaded scripts by using FireBug, and I cannot see the javascript file in the list after the post back. I asusmed once it is included to page on the first load, browser will be caching it so that I do not need to re-include it.
What am I doing wrong?
[code]...
View 1 Replies
May 20, 2010
Assume a simple aspx data entry page in which admin user can upload an image as well as some other data. They are stored in database and the next time admin visits that page to edit record, image data fetched and a preview generated and saved to disk (using GDI+) and the preview is shown in an image control.
This procedure works fine for the first time however if the image changes (a new one uploaded) the next time the page is surfed it shows previously uploaded image. I debugged the application and everything works correct. The new image data is in database and new preview is stored in Temp location however the page shows previous one. If I refresh the page it shows the new image preview. I should mention that preview is always saved to disk with one name (id of each record as the name).
I think that is because of IE and other browsers use client cache instead of loading images each time a page is surfed. I wonder if there is a way to force the client browser to refresh itself so the newly uploaded image is shown without user intervention.
View 2 Replies
Oct 25, 2013
when i first run my applcation some time its showing the data from cache.i want to avoid it in first time .
i want to cache my all images/css/js file what is the efficient way to do it.
i have lot of images folder /js /css files.
View 1 Replies
Apr 1, 2011
My requirement is to get the file size in client side. there is no problem in FF but in IE you can't do that unless u r using an activeX object. So we thought of putting it in browser cache and reading the file size from there and when we post it to the server we will be taking it from the cache and send it to the server.
View 4 Replies
Feb 22, 2011
[Code]....
How to prevent browser from caching image, Trsponse.Cache.NoStore didn't work
View 3 Replies
May 1, 2010
I'm missing a the code browser when I create pages that have the code not placed in a seperate file. For pages with .asp.vb files I get the browser correctly.
I think it's called a code browser but just in case it's not I mean the dropdown that shows Page Events, Buttons and other controls that can be selected along with their events.
How do I turn on those dropdowns for pages with code behind that uses <script> tags in the actual .aspx page?
Included (Showing page events just under the tab):
Missing
View 1 Replies
Aug 18, 2010
Is it possible to programmatically cache an image using VB code behind? If so, can someone lead me in the right direction?
View 14 Replies
Jan 22, 2010
MSVS 2005 asp.net 2.0 ajax enabled site..
I havent used asp.net 2.0 rsskit..didnt know there wasone..
anyways.. I have this RSS code that pulls RSS contents from a stored proc into a dataset (ds)..
Question : How can I cache the Dataset variable (ie ds) so that if I have 100 hits in 5 min I dont get 100 pulls on the stored proc. [NOTE: I assume its best to cache the dataset]
my code for RSS from the dataset (note has a few custom function etc..)
[Code]....
View 1 Replies
Mar 16, 2010
I have a asp.net web application and I'm using cache (HttpRuntime.Cache) to save some stuff from db.
I also update db from time to time so that data in db does not match the data in my application's cache.
Is there any way how to clear my application's cache without modifying any source code or republishing the page?
I tried to restart IIS and to clear browsers cache
View 3 Replies
Feb 7, 2011
I am working on page where data will update in every 10 second by scraping data from other Stock website. So basically page is displaying stock data which update in every 10 seconds. I am using update panel and timer control. Now problem is that if 100 users open the webpage 100 request go server in each 10 seconds. I want to implement Cache on page where Cache version of page serves to other user. I am using <%@ OutputCache Duration="10" VaryByControl="Timer1" %> but when event occur code run intends of delivering Cache version of page. What I am doing for test.
1) Open page in different browser in local
2) Checking browser type using code
Dim s As String = ""
With Request.Browser
s &= "IP = " & HttpContext.Current.Request.UserHostAddress & vbCrLf
s &= "Browser Name = " & .Browser & vbCrLf
End With
Label1.Text = s
if page first open in IE then if I again open in firefox it shows browser type IE but after 10 sec interval it will update type to firefox. So I want to display Cache data only instead of executing server side code for each different browser.
View 1 Replies
Mar 29, 2010
Is it correct to implement my caching object like this in my controller :
[code]....
And I Use it like this :
[code]....
View 1 Replies
Feb 25, 2011
We have a wfc layer that wraps the business classes and database access and use a client that lives on the database layer. Amongst our group we are attempting to form standards. Some want to have the client call the web method and pass the page they are requesting and the page size. Pass that to the database and then page in SQL Server use RowNum.Some want to cache the full list of objects in http cache on the service tier and page in memory. They concern here is memory use on the server.
Which would be best for a medium number of users with potentially large number of records to manage (say 30K) Is it better to cache them all in memory and work from there or page at the database as the application scales?
View 1 Replies
Jul 28, 2010
What are the "optimal" parameters for creating an AppFabric cache when you will be storing session state in the cache? MSDN Cache-Related Commands
Powershell command line:
New-Cache [-CacheName] <String> [-Eviction <String>] [-Expirable <String>] [-Force [<SwitchParameter>]] [-NotificationsEnabled <String>] [-Secondaries <Int32>] [-TimeToLive <Int64>]
[code]...
Since I don't want my sessions to be removed unless the session has been abandoned either via code or Session Timeout...For eviction, I would think "None" and for expireable, I would think False.I have tested and calling Session.Abandon does remove the object from the cache. I have also tested to see if by extending my session, the session object in cache is also extended. This does seem to work the "correct" way.
View 1 Replies