Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

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

 
Thread Tools Search this Thread
Old 11-25-2007, 02:57 PM   #1
Default 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


Mike
  Reply With Quote
Old 11-25-2007, 03:50 PM   #2
Juan T. Llibre
 
Posts: n/a
Default Re: In ASP.NET can I cache a <body>'s background image?
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" <> wrote in message news:2386CD3B-085E-4A98-B1B1-...
> 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





Juan T. Llibre
  Reply With Quote
Old 11-25-2007, 09:58 PM   #3
Alexey Smirnov
 
Posts: n/a
Default Re: In ASP.NET can I cache a <body>'s background image?
On Nov 25, 3:57 pm, Mike <M...@discussions.microsoft.com> wrote:
> 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


Alexey Smirnov
  Reply With Quote
Old 11-26-2007, 05:51 PM   #4
Mike
 
Posts: n/a
Default Re: In ASP.NET can I cache a <body>'s background image?
Thank you both for your help!

"Alexey Smirnov" wrote:

> On Nov 25, 3:57 pm, Mike <M...@discussions.microsoft.com> wrote:
> > 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
>



Mike
  Reply With Quote
Old 11-29-2007, 06:27 AM   #5
Wainage
 
Posts: n/a
Default RE: In ASP.NET can I cache a <body>'s background image?
Easiest way ... CSS file

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

Browsers will cache background images.



Wainage
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp.net 2.0 using cache dipakprodhan Software 0 03-15-2009 03:42 PM
Create .EPS Image With ASP.NET (Using C#.NET) sovan Software 0 07-06-2006 09:29 AM
Newbie on Mac: Menu background, button and image quality issues Danny Boy DVD Video 4 01-03-2006 05:07 PM
Image acquires Criterion Goro DVD Video 2 08-04-2005 02:28 AM
Pictures save as bitmap files Anthony A+ Certification 5 01-24-2005 11:58 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46