473,769 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2281
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=NumberOfSec onds"

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**@discussio ns.microsoft.co mwrote in message news:23******** *************** ***********@mic rosoft.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...@discussio ns.microsoft.co mwrote:
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. AppendCacheExte nsion("max-age=NumberOfSec onds");

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...@discussio ns.microsoft.co mwrote:
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. AppendCacheExte nsion("max-age=NumberOfSec onds");

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
11076
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 reason, there's an annoying vertical gap between adjacent rules that doesn't go away. This looks like IE6 is incorrectly setting the margin to some arbitrary value. Does anyone know if this is a known bug at MS? If you know of one, post the...
5
116807
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%" background="images/nav_bar/nb_spacer.gif">&nbsp;</td> which works in all major browsers that I've tried, but doesn't validate. No background attribute to the td tag, apparently. What is the correct way to do this? A stylesheet entry with a
2
2572
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 seem from the URL!) I'm using a <ul> for the gimmicky teddy bear links. The teddy is a background image for each <li>. Each link 'button' is an <a> within an <li>, and I'm trying to get the button to appear partway down the teddy
6
13024
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 is not an ASP.NET related question, but I know this group is knowledgeable and quick with responses. Thanks
2
2524
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 transparent gif image I can't use LinkButtons over this image. The string that I'm using now is: <body background="BMP/Header.gif" MS_POSITIONING="GridLayout"> Maybe I should use something else in place of GridLayout?
7
2214
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 figure out why. Here is the section from the style sheet: body { margin:0; color:#002200;
12
4931
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
13539
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 semantically meaningless containers for bunch's of other elements - like everyone keeps telling me to make my code standards compliant. This request is not because I want a fix, but because I want to
3
5753
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
9589
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
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7413
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
6675
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
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
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
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.