473,396 Members | 1,738 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,396 software developers and data experts.

Weird Browser Request

I have a page in ASP.Net 1.1 which contains an image control.

I set the ImageUrl property = "MyImageViewerPage.aspx"

This page acts as an image handler. I have an array of bytes which I send to
the browser using BinaryWrite.

e.g. Response.ContentType = mVar.contenttype
Response.BinaryWrite(mVar.MyBytes)

This all works great.

The problem is that if I request the main page using 2 different links I
sometimes get the wrong image.
But other times I get the right image. There is no pattern to this.

What I have found is that if I set a break point in page load of my image
handler page that it does not always get called. I confirmed this behavior
using Fiddler.

When I call the main page and I get the right image, Fiddler shows 2
requests - one for the main page and one for the image.

When I call the main page and get the wrong image, Fiddler only shows a
single request for the main page.
(Note the wrong image is just the image from the previous request that
worked. The rest of the data on the main page changes to the right record -
but since the image handler never gets called the old image is now shown on
the page.)

The question is - why does my browser not request the image handler page
every time?
I have even tried hardcoding it using an html control instead of an asp
control. No luck.
(BTW - both pages have expires = -1 in Fiddler.)

Thanks for any ideas.
--
Joe Fallon


Nov 20 '05 #1
3 1416
the browser and proxy servers cache the images. set the page to expire, or
better yet decorate the url with an image id (then you get the caching if
they return to an old page).

-- bruce (sqlwork.com)
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have a page in ASP.Net 1.1 which contains an image control.

I set the ImageUrl property = "MyImageViewerPage.aspx"

This page acts as an image handler. I have an array of bytes which I send
to the browser using BinaryWrite.

e.g. Response.ContentType = mVar.contenttype
Response.BinaryWrite(mVar.MyBytes)

This all works great.

The problem is that if I request the main page using 2 different links I
sometimes get the wrong image.
But other times I get the right image. There is no pattern to this.

What I have found is that if I set a break point in page load of my image
handler page that it does not always get called. I confirmed this behavior
using Fiddler.

When I call the main page and I get the right image, Fiddler shows 2
requests - one for the main page and one for the image.

When I call the main page and get the wrong image, Fiddler only shows a
single request for the main page.
(Note the wrong image is just the image from the previous request that
worked. The rest of the data on the main page changes to the right
record - but since the image handler never gets called the old image is
now shown on the page.)

The question is - why does my browser not request the image handler page
every time?
I have even tried hardcoding it using an html control instead of an asp
control. No luck.
(BTW - both pages have expires = -1 in Fiddler.)

Thanks for any ideas.
--
Joe Fallon

Nov 20 '05 #2
Bruce,
Thanks for the quick response.

I have this code in both the main page and the image handler page:

Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0
Response.CacheControl = "no-cache"

So I would think that there is no caching going on.
Also, Fiddler does not show a 302 for the image when it is cached - there is
no request for it at all.

--
Joe Fallon

"Bruce Barker" <br******************@safeco.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
the browser and proxy servers cache the images. set the page to expire, or
better yet decorate the url with an image id (then you get the caching if
they return to an old page).

-- bruce (sqlwork.com)
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have a page in ASP.Net 1.1 which contains an image control.

I set the ImageUrl property = "MyImageViewerPage.aspx"

This page acts as an image handler. I have an array of bytes which I send
to the browser using BinaryWrite.

e.g. Response.ContentType = mVar.contenttype
Response.BinaryWrite(mVar.MyBytes)

This all works great.

The problem is that if I request the main page using 2 different links I
sometimes get the wrong image.
But other times I get the right image. There is no pattern to this.

What I have found is that if I set a break point in page load of my image
handler page that it does not always get called. I confirmed this
behavior using Fiddler.

When I call the main page and I get the right image, Fiddler shows 2
requests - one for the main page and one for the image.

When I call the main page and get the wrong image, Fiddler only shows a
single request for the main page.
(Note the wrong image is just the image from the previous request that
worked. The rest of the data on the main page changes to the right
record - but since the image handler never gets called the old image is
now shown on the page.)

The question is - why does my browser not request the image handler page
every time?
I have even tried hardcoding it using an html control instead of an asp
control. No luck.
(BTW - both pages have expires = -1 in Fiddler.)

Thanks for any ideas.
--
Joe Fallon


Nov 20 '05 #3
Bruce,
I used your idea of adding an imageID to the querystring and now it works.

I set the ImageUrl property = "MyImageViewerPage.aspx?imageID=123"

Thanks for the advice.
--
Joe Fallon

"Bruce Barker" <br******************@safeco.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
the browser and proxy servers cache the images. set the page to expire, or
better yet decorate the url with an image id (then you get the caching if
they return to an old page).

-- bruce (sqlwork.com)
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have a page in ASP.Net 1.1 which contains an image control.

I set the ImageUrl property = "MyImageViewerPage.aspx"

This page acts as an image handler. I have an array of bytes which I send
to the browser using BinaryWrite.

e.g. Response.ContentType = mVar.contenttype
Response.BinaryWrite(mVar.MyBytes)

This all works great.

The problem is that if I request the main page using 2 different links I
sometimes get the wrong image.
But other times I get the right image. There is no pattern to this.

What I have found is that if I set a break point in page load of my image
handler page that it does not always get called. I confirmed this
behavior using Fiddler.

When I call the main page and I get the right image, Fiddler shows 2
requests - one for the main page and one for the image.

When I call the main page and get the wrong image, Fiddler only shows a
single request for the main page.
(Note the wrong image is just the image from the previous request that
worked. The rest of the data on the main page changes to the right
record - but since the image handler never gets called the old image is
now shown on the page.)

The question is - why does my browser not request the image handler page
every time?
I have even tried hardcoding it using an html control instead of an asp
control. No luck.
(BTW - both pages have expires = -1 in Fiddler.)

Thanks for any ideas.
--
Joe Fallon


Nov 20 '05 #4

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

Similar topics

1
by: VB Programmer | last post by:
I went to a few ASP.NET websites today. For some aspx pages I get this error (too consistently, which is why I think it's my PC): Server Error in '/CuteEditorTest' Application....
2
by: Roger Twomey | last post by:
I have an application that checks for browser, version and active X enabled. It uses the result for a simple if then. The issue I have is that Request.Browser.MajorVersion is returning the...
1
by: hecsan07 | last post by:
I am trying to perform site login using values from a cookie, but for some weird reason the cookie is being destroyed after the browser window is closed. I checked the browser settings for the...
2
by: Craig G | last post by:
is there a way to distinguish whether a client is using IE or Netscape? is there some sorta check i can run on the Page_Load event? or where would be the best place to do this? Cheers, Craig
4
by: Brian | last post by:
I replaced my submit buttons with image buttons on my forms.. I need to display the results of the fields that were entered. On my test server, it works great, but on my live server, I am seeing...
1
by: Dees | last post by:
Hi, I am facing a weird problem with HTTPS and Request.Url.AbsoluteUri in my ASP.NET application. Here is the scenario - 1. I have a menu page (Default.aspx), which has the following anchor -...
2
by: Todd | last post by:
I'm writing a cookie in one asp.net page, then trying to read that new value in another. Problem is, the saved value disappears when the cookie code calls it! Here's the code... SETTING THE...
5
by: Mufasa | last post by:
We want to keep track of what OS/Browser people are using for our website. How can I find that out so that I can write it to a DB ? I know how to get it into the DB; I just need to know how to get...
7
by: Anil | last post by:
I have a Javascript program which runs in the browser and has functions work(), and stop(). It listens to commands from the server to work() and can be interrupted by the server to stop(). I am...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.