page cached that should not be cached

Hi, Thanks for the support.

I'm using ASP.NET 2 but my problem is that I have an asp.net web page called: extractimage.aspx that receive a query string parameter and returns an image, so I call it by:

~/inicio/extractimage.aspx?usu=25

I have a linkbutton in a grid with this link, so I refresh the Grid and the correct image should be shown.

But when I change the image in other page and I try to refresh the Grid, the previous image is shown, not the new one.

It seems the extractimage.aspx web page is cached and I do not want that, I would like the current image is always displayed, not the old one.

I found tracing the page that the second time I call extractimage.aspx, its page_load method does not be called.

What should I do not to caching this web page?

The web page is only:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="extraeimagen.aspx.cs" Inherits="extraeimagen" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Extrae imagen</title>

</head>

<body>

<form id="form1" runat="server">

<div>

</div>

</form>

</body>

</html>

thanks a lot,

Daniel.


.net developer with VStudio 2005.
Asp.Net 2.0. and Ajax
Sql Server 2005
0
dany7487
2/14/2008 6:06:47 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

4 Replies
819 Views

Similar Articles

[PageSpeed] 28

When you reference the image, add an extra parameter like this:

 ~/inicio/extractimage.aspx?usu=25&rand=4720481982747

You can just set "rand" to a random number of some large range. That way, when the browser sees this request, it thinks that it is different from the previous request and will not use the cache. This also means that no image retrieved by this page will be cached, even if you want it to be.


0
EndangeredMassa
2/14/2008 6:59:29 PM

 Try to add the below code at page_load event

 Response.Cache.SetCacheability(HttpCacheability.NoCache);

HC 


Haissam Abdul Malak
MCAD.NET
| Blog |
0
Haissam
2/14/2008 8:47:50 PM

Hi,

It was an excellent idea to use a random number.

Now It works!

 thanks a lot!!

Daniel.


.net developer with VStudio 2005.
Asp.Net 2.0. and Ajax
Sql Server 2005
0
dany7487
2/14/2008 10:48:37 PM

I've read that using the "no cache" method is not reliable. Some browsers will cache it anyway. 

0
EndangeredMassa
2/15/2008 9:13:46 PM
Reply:

Similar Artilces:

Caching, Caching,Caching,Caching,Caching Why nobody know???
I have posted this problem quite a few times but never got a decent answer and I have still not found a solution. Every time I have a gridview when the page is refreshed the data in the gridview does not refresh. You might say well and GridView.DataBind() to the pageload method but I think there is a performance problem if you bind your gridviews every time. For example I have a dropdownlist, a gridview and button and the gridview is supposed to refresh depending on the value in the dropdown when the button is pushed. if you click on the button the gridview data does not change unless y...

Difference between System.Web.Caching.Cache and System.Web.HttpContext.Current.Cache
Hi,   Can any one help me to understand the difference between the web caching and teh  httpcontext caching. Which is best to use. Does any one have the some good links on this topic. Thanks in advance for all ur time. System.Web.Caching.Cache: this is the implementation of .NET caching.System.Web.HttpContext.Current.Cache: this is the instance of that implementation, that lives in the application domain.You should use System.Web.HttpContext.Current.Cache for storing your data.More info:How to: Add Items to the Cache:http://msdn.microsoft.com/en-us/library/18c1wd61(VS.80)....

to cache or not to cache?
i have a toolbar at the top of all my web pages and I am not sure whether it is worth caching or not. this toolbar is in fact a search facility consisting of 4 dropdownlists. 3 of the DDL's are static and 1 is databound. i would like to make the whole toolbar into a user control and cache it. Q1. If one of the DDL's selected item has changed the user control must know not to load from the cache. is it possible to include this kind of logic to a cached user control? Q2. Is it worth caching my toolbar? Or should I just consider caching the 1 databound DDl instead? any help much apprec...

To cache or not to cache
It's a well known fact that it's a good practice to cache results of SQL queries. But here as everywhere we should limit ourselfs and not to cache everything, shouldn't we? ) For example, you know that in facebook you can enter information about yourself - first name, last name, all your schools, jobs and so on. This data changes very rarely. So, as books say this data is perfect to be cached. But, you see, there can be millions of users with there profiles in our cache. So.. to cache or not to cache? )  it is a good practice to use limited size content and low edit freque...

To Cache or Not To Cache?
Hello, I'd like the opinion of the community on this question. We've just completed a migration from Exchange 5.5 to GroupWise 7. Migration went well. Right now, everyone is using WebAccess but I am rolling out the GroupWise Windows client (with latest FTFs) along with an updated XP SP2 workstation image shortly, to the office people. They had been using Outlook with Exchange, no caching. We have 6 locations with office people. About 25 are local to the PO server. The other locations, ranging from 25 to 8 per location are connected to the PO server via a T-1 WAN lin...

To cache or not to cache ?
I am really confused here. What I have are two forms one is where I get metadata for a document and next page where the user uploads the file for that document. What I want is a link from upload page back to the metadata page with the fields still filled in (cached maybe ?) and a link that takes back to that page without cache...In other words..I want two links on upload page one that take users back to the metadata page with fields filled in from previous request and the other link which takes to metadata form with empty fields. I am not sure how to accomplish this. I tried using ca...

Web Form pages are cached locally in browser.
Hi All, I have a problem with my ASP.NET application. When a user logs into the system and does some operations and clicks on Logout then the user details are cleared from Session and the application redirects to the HomePage. Next another user, logs into the system (using the same browser) and clicks on the browsers back button and was able to look at the pages visited by the previous user. I have set the "no-cache" option for my web form. Still the problem exists. Is there any workaround for this. Thanks in advance. Thivya     Please refer to the following article to ...

System.Web.Caching.Cache
HiWe had a debate here at our office what happens if you add an item to the cache _without_ telling anything about expiration times.If you type...cache("foo")=myobj...will myobj be placed in the cache...1. Forever (if the GC doesn't collect it because of high memory use)2. Some unknown (to us) default expiration timeThanks in advanceR If you don't provide any dependencies or expiration time then the object remains in the cache for the duration of the AppDomain being up.  However, as always, there is a wrinkle.  If the worker process starts getting low on memory, then objects...

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

Listing the pages that are cached by output cache
 Hi, Is it possible to list the pages that are currently cached using output cache?Are they cached using the Cache object or some other object? and how can I list them? Thanks, Dror.  Although, not exactly, but this post might helpin finding morehttp://www.vikramlakhotia.com/How_to_know_the_all_the_data_in_the_cache_of_an_AspNet_Application.aspx Vikram www.vikramlakhotia.comPlease mark the answer if it helped you  Thanks.This helped a bit. in the cache object there's a hashtable listing all the "Cached Items".They key is the path of the webpag...

.Net Caching Ughhhh (Micro-caching)
I'm designing an application where data is continuous and becomes dirty in a matter of seconds. The load is also high and therefore, to avoid straining the database server, i cache all data for a couple of seconds. That's fine. However, some data are HIGHLY VOLATILE and requires the most latest data...for these types of data, I use 1 second caching. I done benchmarks of 1-6 second caching and the benefits on a high load server is enormous. However there is a problem with this micro caching technique.....the problem is...some of the objects get destroyed as soon as it is pulled out. ...

confuse with System.Web.Caching.Cache
hi, i know that System.Web.Caching.Cache is shared by all sessions. i don't undertand how asp.net makes it so (Cache is shared by all all sessions) In .net sdk docuement i see that "Only one instance of Cache is created in one Application Domain". But Reflector shows that the Cache class does not use the singletonn design pattern. Thank you for your help.What really matters most is the chance to communicate with you, my friends, rather than marking my post as answer, though I would be really appreciated if you do so. No one has an idea? What really...

How to disable the system.web.caching.cache
Hi Guys, Im currently using some cms tool for my web application. All the page content stores in sql database. This cms tool is using system.web.caching.cache to store the page content in cache to improve the performance. The problem im facing is the page always shown the old content as it refuse to get the new content for the page. I can get the new content by doing the following things:- changing the url to upper case- restart iis- change web.config Im using site.master page, cms tool uses this master page + the content from the database to rewrite the dynamic url on the fly.I tried ...

Fragment Caching
Caching is one of the recommended techniques to improve the performance of web applications by avoiding repeated requests to the server. This Article explains how we can cache only a particular portion of a page. Thanks.regards,Harishhttp://geekswithblogs.net/ranganh...

Web resources about - page cached that should not be cached - asp.net.web-forms

ALERT: Deleted Facebook Photos Remain Online, Cached
Remember those Facebook photos you deleted a few months ago, or even a few years ago? They must be gone, right? Um, not so fast.

cached link - 9to5Google
9to5Mac 9to5Google 9to5Toys Community About Tips/ Contact X 9to5Google: Beyond Good and Evil Menu Plus Android Chrome/OS Search Google Apps GoogleTV ...

ALERT: Deleted Facebook Photos Remain Online, Cached - SocialTimes
Remember those Facebook photos you deleted a few months ago, or even a few years ago? They must be gone, right? Um, not so fast.

Play Music updated with fix for disappearing cached tracks issue
Since the latest update, Google Play Music no longer deletes cached music from devices, an issue that has been affecting some users for the past ...

Tip: Turn On This Chrome Flag To Enable 'Show Saved Copy' Button And Load Cached Pages When Offline [Updated] ...
Loading up a website without a connection established is a real shame. Instead of the information you were looking for, Chrome shows you a dinosaur ...

Quickly access Google cached pages in Chrome
Here are two easy ways to find the cached versions of Web pages when you're searching Google in your Chrome Web browser. Read this article by ...

Chrome for iOS update adds voice search, faster reloading for cached pages
... will also now talk back ( politely ) to users, relaying answers to specific queries. And thanks to some additional under-the-hood tweaks, cached ...


minor highlighting bug in cached page - Google Product Forums
Good catch, Kent! I'll pass it on to the team, thanks for posting!

Cached Windows passwords sound risky but aren't
Companies fear pass-the-hash attacks and cached Windows passwords. But disabling them can cause other problems

Resources last updated: 12/27/2015 9:27:50 AM