![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
I am using a http handler to read and generate dynamic images from SQL and other sources. The following code snippet works fine, but caching needs some work. (I have not provided all of my image code.) The image does appear to be cached at the server, as there is little or no SQL activity when a client is repeatedly hitting the web site, but there does seem to be a lot of w3wp.exe activity. (Somewhat unscientific.) |
|
What am I missing to get the client to cache the image and not make requests to the server? |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Hi I meant to ask - Andrew what is the filetype of the 'path' attribute in your web.config that ties the request to the handler in the code behind? eg. mine is: add verb="GET" path="title.axd" type="... etc are you using a .jpg file, or an axd like me? I chose to use an axd after reading a good article, but does this affect how the browser deals with such a file? Would it make any difference if I used a .jpg and reconfigured IIS to process it correctly? TIA GW -- geedubb ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------ |
#7
| |||
| |||
|
|
GW, A couple of things: 1. I am not making any changes to my web.config to register the handle. I simple include a file of type .ashx and it has a single line in it: %@ WebHandler Class="AbcProject.WebTier.Content" % then I have a class in my project with the name: Content and the name space: AbcProject.WebTier Seems to work well and I don't have to muck with the config file. 2. I am setting the following cach parameters: httpContext.Response.Cache.SetExpires(DateTime.Now .AddMinutes(20)); httpContext.Response.Cache.SetCacheability(HttpCac heability.Public); httpContext.Response.Cache.SetValidUntilExpires(tr ue); httpContext.Response.Cache.SetLastModified(created Date); IE seems to cach at the browser. Firefox does not. I wounder if this is somehow related to the browser caps config info or lack of for Firefox.? |
#8
| |||
| |||
|
|
Andrew Robinson wrote: GW, A couple of things: 1. I am not making any changes to my web.config to register the handle. I simple include a file of type .ashx and it has a single line in it: %@ WebHandler Class="AbcProject.WebTier.Content" % then I have a class in my project with the name: Content and the name space: AbcProject.WebTier Seems to work well and I don't have to muck with the config file. 2. I am setting the following cach parameters: httpContext.Response.Cache.SetExpires(DateTime.Now .AddMinutes(20)); httpContext.Response.Cache.SetCacheability(HttpCac heability.Public); httpContext.Response.Cache.SetValidUntilExpires(tr ue); httpContext.Response.Cache.SetLastModified(created Date); IE seems to cach at the browser. Firefox does not. I wounder if this is somehow related to the browser caps config info or lack of for Firefox.? I would add a call httpContext.Response.Cache.SetMaxAge(new TimeSpan(0, 20, 0)); since this is the preferred way to specify expiration times in HTTP 1.1. Did you verify that Firefoy really does try to fetch the image again? Cheers, -- http://www.joergjooss.de mailto:news-reply (AT) joergjooss (DOT) de |
#9
| |||
| |||
|
|
Joerg, Thanks for the info. Added the line, but it appears that the same thing is still happening. I am using SQL Profiler to see that there is SQL activity. When I run the same page with IE6, I get no SQL activity. hummm? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |