473,795 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

clearing the cache also image is not refreshed

30 New Member
hi,
i have a problem.
i am saving bitmaptextimage dynamically in data/image1.jpg every time when i redirect to the image.aspx page and i am assignning this image url to the image control.but image is not refreshing.if we press F5 or REFRESH button then image is refreshing.
i have used following techniques

Expand|Select|Wrap|Line Numbers
  1. Response.Cache.SetCacheability(HttpCacheability.NoCache);
  2. Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
  3. Response.Cache.SetLastModified(DateTime.Now);        
  4. Response.Cache.SetAllowResponseInBrowserHistory(false);
  5.  
  6. <%@ OutputCache Duration="1" VaryByParam="None" %>
  7.  
  8. <meta http-equiv="refresh" 
  9. content="[n];url=http://www.microsoft.com/pagename.htm">
reply me please
Nov 30 '07 #1
6 1824
kenobewan
4,871 Recognized Expert Specialist
OutputCache location="none" . HTH.
Nov 30 '07 #2
Plater
7,872 Recognized Expert Expert
I've had good luck with
Expand|Select|Wrap|Line Numbers
  1. Response.Cache.SetNoStore();
  2.  
But you would need a way to set that header for the image request too.
Nov 30 '07 #3
Frinavale
9,735 Recognized Expert Moderator Expert
I know this problem!
I had it a few months back.
I had to dynamically retrieve an image from a database and show it to the user based on their account...I allowed them to update this image and I was stuck with the old one displaying..... ..

Here's what happened:
I gave the image a name when I grabbed the image from the database and stored it temporarily in the folder where the web server could retrieve it...so it could be displayed in the web browser.

Every time this happens, the image is named the same thing (based on the user's login properties).

The browser grabbed that image and cached the image.
When the browser came back to the page, the old image would always appear because the browser didn't download the new image.

So to get around this problem I appended random numbers to the image name...forcing the browser to download the new image.


The meta tag that indicates "no-cache" did not help resolve this issue because this tag is used by ASP.NET, not your web browser.

It allows the ASP.NET technology to determine whether or not a cached version of the compiled ASP code should be used...

Setting this meta tag to "no-cache" indicates to the ASP.NET technology that the ASP code should be compiled every web-request.

I could be wrong about this...but I'm almost 100% sure.
Nov 30 '07 #4
Plater
7,872 Recognized Expert Expert
Instead of writing a lot of temporary files, you could also create a serve-up page that responds back with "content-type: jpeg" and the jpeg data.
I use that for certain situations, helps control security a little better.
Nov 30 '07 #5
Frinavale
9,735 Recognized Expert Moderator Expert
Instead of writing a lot of temporary files, you could also create a serve-up page that responds back with "content-type: jpeg" and the jpeg data.
I use that for certain situations, helps control security a little better.
Or you could overwrite the old jpegs with new :D
Nov 30 '07 #6
Plater
7,872 Recognized Expert Expert
Or you could overwrite the old jpegs with new :D
My file system does not allow write access to the webservice for any of it's directories contained withen itself. So writing a bunch of temporary files that are available to the outside world through http is not permsible.
Just an alternative :-P
Nov 30 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1591
by: Bill Puetz | last post by:
I have a form with 4 different Submit buttons. In the action code, I do a request on the button names to see which one is valued. This all works great, until the browser is refreshed -- the request shows the name of the last button pressed. Is there a way to clear all the buttons so they don't appear to have been pressed when they've only been refreshed?
0
1075
by: Micha³ Januszczyk | last post by:
is there any way to tell whether the application has entered the shutdown state ? I put some data into aspnet cache. Special callback method is specified that should be called when cache item is removed from cache. The handler method deletes specified file from disk. The problem is that the cache is cleared upon application shutdown and all cached objects are implicitly removed. This involves that my handler is also called and the...
6
1991
by: Charts | last post by:
I used HttpContext.Current.Cache To cache data from database. The code is like that. public static DataView GetCategories() { if ( HttpContext.Current.Cache == null ) { HttpContext.Current.Cache = GetCategoriesFromDB(); } return (DataView)HttpContext.Current.Cache;}
6
9652
by: JJ_377 | last post by:
In a "Save and Quit" button on my web app form (aspx), I have the following code that is supposed to clear a session variable (an user id) and redirect to a logon page: Session.Clear() Session.Abandon() Response.Redirect("ApplicantLogon.aspx") 1. The redirect occurs, but the session variable does not clear.
0
2991
by: PD | last post by:
I am trying to stream out a PDF file via the response object and when I execute the code it always brings up the first document that I pulled up.Even when I step through the code, I can see the new values in theData string array (see code below), but it serves up the first document that I had run this code with. I streamed theData into a text file to look at the values and it contained the appropriate ones for the new document. Even when I...
7
3346
by: Jake Barnes | last post by:
I've a little webcam program that snaps a picture of me and uploads it every 20 seconds. It automatically uploads the image to my server. It always give the image the same name, and thus it overwrites the image that has been there for the last 20 seconds. People can, if they wish, hit the refresh button every 20 seconds, but I thought it would be fun to have a Javascript function that actually refreshed the image. However, this following...
0
1640
by: negmat | last post by:
Hello everyone, I have the following question: I am aware that the objects currently in the cache can be viewed by issuing the following command: SELECT * FROM master.dbo.Syscacheobjects Further, cache contents can be cleared by issuing the following command:
3
4015
by: wardemon | last post by:
Hi All, I have a aspx page named: ImageProcess.aspx that creates a thumbnail version of an image by passing the ImagePath, width, and height. The ImagePath is taken from a table from a database, while width and height is user specific - meaning user can change this on demand. My question is, although this rendering images on the fly is cool, I would like to implement some sort of mechanism/logic that it wont keep rendering the thumbnail...
0
1508
by: Nizha | last post by:
Hi, The browser cache is not getting clearing inspite of setting these headers.. <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader ("Expires",-1); //prevents caching at the proxy server %>
0
9672
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
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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...
1
7540
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
6780
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.