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

In ASP.NET can I cache a <body>'s background image?

Hi. I'm building an ASP.NET 2.0 web-app for a customer. The customer wants
a background image that's 124k in size as the background for each page. I've
recommended they use a smaller-size image, but the customer is absolutely
adamant about using the image.

I'm afraid that this large image will degrade performance if it's loaded for
each page. Can I somehow use ASP.NET caching to cache the background image
so it doesn't have to refresh on each page load?

Thanks, Mike
Nov 25 '07 #1
4 2262
Set a custom header, which specifies "max-age".

Open the IIS Manager snap-in from Administrative Tools, pick an app,
right click, go to Properties, switch to the HTTP Headers tab, and click Add.

Add cache-control extensions like this:

In the "Custom Header Name", type : Cache-Control

In the Custom Header Value, type :

"Cache-Control:max-age=NumberOfSeconds"

OK your way out of the dialog...

I use :
"Cache-Control:max-age=1200"
....which will cache images for the default session timout ( 20 minutes ).

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Mike" <Mi**@discussions.microsoft.comwrote in message news:23**********************************@microsof t.com...
Hi. I'm building an ASP.NET 2.0 web-app for a customer. The customer wants
a background image that's 124k in size as the background for each page. I've
recommended they use a smaller-size image, but the customer is absolutely
adamant about using the image.

I'm afraid that this large image will degrade performance if it's loaded for
each page. Can I somehow use ASP.NET caching to cache the background image
so it doesn't have to refresh on each page load?

Thanks, Mike

Nov 25 '07 #2
On Nov 25, 3:57 pm, Mike <M...@discussions.microsoft.comwrote:
Can I somehow use ASP.NET caching to cache the background image
so it doesn't have to refresh on each page load?
Mike, you can also write a custom HttpHandler and map images to the
ASP.NET ISAPI in IIS. And then from ASP.NET you will be able to add
cache contol values, the same what Juan told you

Response.Cache.AppendCacheExtension("max-age=NumberOfSeconds");

I would also recommend you to check:
http://aspnetresources.com/blog/cach...xtensions.aspx
Nov 25 '07 #3
Thank you both for your help!

"Alexey Smirnov" wrote:
On Nov 25, 3:57 pm, Mike <M...@discussions.microsoft.comwrote:
Can I somehow use ASP.NET caching to cache the background image
so it doesn't have to refresh on each page load?

Mike, you can also write a custom HttpHandler and map images to the
ASP.NET ISAPI in IIS. And then from ASP.NET you will be able to add
cache contol values, the same what Juan told you

Response.Cache.AppendCacheExtension("max-age=NumberOfSeconds");

I would also recommend you to check:
http://aspnetresources.com/blog/cach...xtensions.aspx
Nov 26 '07 #4
Easiest way ... CSS file

-------------------------------------------------------------
body { background-image: url( 'images/massivepic.jpg' ); }
-------------------------------------------------------------

Browsers will cache background images.

Nov 29 '07 #5

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

Similar topics

34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
5
by: Derek Fountain | last post by:
I have a horizontal navigation bar, which is a single row table containing the right images. It "stretches" itself across the screen using a penultimate td like this: <td width="100%"...
2
by: Andrew Donaldson | last post by:
I'd welcome some help in understanding what's going on with graphical browsers in the navigation list at: http://www.bounceandtickle.org.uk/index.html (This site is not about what it might...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
2
by: Just D. | last post by:
Who knows what should we include into aspx file to show some image as a background picture but only once at the top of the page? I don't want to add the Image control because even if it uses a...
7
by: Greg Heilers | last post by:
Perplexing problem: All of a sudden, the code I am tinkering with; renders a white-space margin around all four edges of the browser window (Mozilla, Firefox, Konqueror, and Opera). I can not...
12
by: Mark Rae | last post by:
Hi, It's easy enough for a child page to manipulate its MasterPage's header simply by modifying the MasterPage thus: <header runat="server"> .... .... </header>
5
by: Agix | last post by:
Hi there, Please check out : http://clarifysolutions.co.uk/certenroll/ The source is included below. This page is a test, so I can play about with paddings, margins and layouts using divs as...
3
by: PYG | last post by:
Hi everybody I have a simple question : If i use this code : <body style="font-size:24px;color:blue;"> Text in body <table> <tr><td> Text in table
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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,...

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.