473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How prevent cachine in ASPX page (I think)?

I have an ASPX page wherein I receive an ID of a file to play.

http://localhost/fwi/mediaplayer.aspx?id=3

When I go to a browser and type in the above, it works fine.

But when I change the 3 to a 4, it still plays the old song.

I tried some lines of code to prevent caching, but so far nothing works.

The only thing that does work, is to click Tool.. Options (in Internet
Explorer) and click to delete temporary internet files. Then song ID=4
plays.

Am I just not yet onto the proper prevent caching code?

Thanks,
Ron
Oct 23 '06 #1
1 1627
Ronald,
This is really an ASP.NET question, not a C# language newsgroup one.
There are lots of ways to prevent caching, some more complex than others,
but if you want to "keep it simple", the key is to understand that if the url
is unique each time, the browser will not find it in its cache and will make
a new request for the resource. A very simple example (I did say, "Keep it
simple", right?):

string resourceUri = "http://localhost/fwi/mediaplayer.aspx?id=3";
resourceUri+="&rand="+System.DateTime.Now.Ticks.To String();

Your URL still has the id=3, but it now also has an additional querystring
parameter
that is not used, but which effectively makes the url unique each time.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ronald S. Cook" wrote:
I have an ASPX page wherein I receive an ID of a file to play.

http://localhost/fwi/mediaplayer.aspx?id=3

When I go to a browser and type in the above, it works fine.

But when I change the 3 to a 4, it still plays the old song.

I tried some lines of code to prevent caching, but so far nothing works.

The only thing that does work, is to click Tool.. Options (in Internet
Explorer) and click to delete temporary internet files. Then song ID=4
plays.

Am I just not yet onto the proper prevent caching code?

Thanks,
Ron
Oct 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jerry Tovar | last post by:
I am using .Net 2003 on a XPPro running IIS. I am unable to view any of my ASPX webforms in a browser unless I modify the .ASPX file and replace Codebehind="employee.aspx.cs" with...
3
by: feng | last post by:
In my ASP.Net app I have a aspx page that's called by an other page's client side JavaScript code. The problem is that the first time this page get loaded, it will be cached in the user's local...
9
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx)...
5
by: Earl Teigrob | last post by:
I am creating an application where I would like to give web designers the ablity to create a static html page and dyanamically load it into my application(exactly like loading a user control into a...
1
by: Les Caudle | last post by:
One aspx page on my site started displaying garbage. No errors, just a bunch of symbol characters. The page used C# code behind and Output Cachine: <%@ OutputCache Duration="86400"...
2
by: kermit | last post by:
I have a .net aspx page MyPage.aspx (client side) with code behind MyPage.aspx.vb (server side). I use the Page_Load event in MyPage.aspx.vb to load data into a multiteir class based...
1
by: Gaetan | last post by:
I'm doing a prrof of concept to develop an application to run under WinPE. The application will use WinHTTP to send requests to an ASPX file running IIS 6.0 My problem is that I do not know how...
4
by: moondaddy | last post by:
I have a .net 1.1 winforms app that calls an aspx page which I need to debug. I also need to start the debugging process from the winform because the winform first calls a web service which passed...
4
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hi, How can I prevent from an ASP.NET page to resend all the data again when the user press the Refresh button or F5 on the browser? Thanks in advanced, Asaf
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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,...

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.