Adding Expiration Date To Headers

I’ve been tweaking the performance of BlogEngine.NEXT today using my favorite tool: YSlow for FireBug. One of the things YSlow checks for is the expires HTTP header for static content such as images, script files and style sheets. Since BlogEngine.NET has always used custom HTTP handlers for serving scripts and stylesheets, only the static images have been a problem.

The problem

The problem is that with images on hosted environments on IIS 6, it’s impossible to control the serving of them without redirecting them through an HTTP handler. That’s not a good idea for several reasons:

  • It adds unnecessary overhead by going through the ASP.NET ISAPI
  • You need to add custom code to handle the requests
  • You need to change the URL from .gif to .gif.axd or similar

Here is what YSlow finds on my website that needs the expires header set to a far future date:

As you can see, it is all my static images that lacks the expires header.

The solution

If you run IIS 6 there is no good way of adding an expires header to images unless you have control over the IIS. If your site is hosted then you probably have no control at all. If you are using IIS 7 however, you can very easily add the header in your web.config’s system.webServer section like so:

 <clientCache httpExpires=”Sun, 29 Mar 2020 00:00:00 GMT” cacheControlMode=”UseExpires” />

What happens is that all static content will now have an expires HTTP header set to the year 2020. Static content means anything that isn’t served through the ASP.NET engine such as images, script files and styles sheets. This is one of the very easy tricks that will increase the performance of your site as well as your YSlow score.


Mads Kristensen
About Mads Kristensen
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

324 thoughts on “Adding Expiration Date To Headers

  1. Pingback:

  2. Pingback: mxkoedfurvxcbxcvdhfeye

  3. Pingback: vwemkfluygvzsdiohfse

  4. Pingback: czxmvxbjhegyfsegfvsdg

  5. Pingback: fmsdkugshfvjkdhfgvsdfvsdf

  6. Pingback: gklsdfngskjhgbjhxdvndshg

  7. Pingback: acsgvedhbnkmglhkmjnhjbvs

  8. Pingback: mcnfgxmrfshdchnfsxjrfsgdvfd

  9. Pingback: zcmvjnergujefvbfasdkjshvdfbv

  10. Pingback: gdsnxcrtkmfcffvshggsdfsvsd

  11. Pingback: fgkxcmfvsdffsdbvsesvsdfvsdv

  12. Pingback: raspberry ketones

  13. Pingback: forskohlii

  14. Pingback: review

  15. Pingback: raspberry ketones diet

  16. Pingback: Blue Coaster33

  17. Pingback: Scarves for Women

  18. Pingback: forskolin coleus forskohlii

  19. Pingback: madrid

  20. Pingback: dr oz fat burning pills

  21. Pingback: raspberry ketone diet

  22. Pingback: garcinia cambogia extract ultra

  23. Pingback: hcg solution

  24. Pingback: Ecom Masters FBA Edition Review

  25. Pingback: Guest Blogging

  26. Pingback: quantum vision system steps

  27. Pingback: quantum vision reviews

  28. Pingback: sigint system

  29. Pingback: kieliszki jako prezenty dla mlodej pary

  30. Pingback: BHP Opole

  31. Pingback: Warszawa ksiegowosc

  32. Pingback: yomega

  33. Pingback: grainger discount code may 2015 promo coupon off

  34. Pingback: Tienda

  35. Pingback: forskolin

  36. Pingback: play rainbow riches slot

  37. Pingback: streaming movies

  38. Pingback: watch tv show episodes

  39. Pingback: stream movies

  40. Pingback: watch movies online

  41. Pingback: stream movies

  42. Pingback: streaming movies

  43. Pingback: tv online, online tv

  44. Pingback: watch tv show episodes

  45. Pingback: free movie downloads

  46. Pingback: watch free movies online

  47. Pingback: dr oz weight loss supplement

  48. Pingback: pure forskolin extract

  49. Pingback: best fat burning pills

  50. Pingback: lotto srategies

  51. Pingback: e-commerce

  52. Pingback: Video Motion Pro review

  53. Pingback: Facebook

  54. Pingback: debt collection

  55. Pingback: sewa mobil surabaya

  56. Pingback: debt collectors

  57. Pingback:

  58. Pingback: cheap sunglasses

  59. Pingback:

  60. Pingback: sell for free

  61. Pingback: green bean coffee pills

  62. Pingback: Video Sales Blueprint

  63. Pingback: how to get the skinny pill

  64. Pingback: The

  65. Pingback: green coffee extract cleanse

  66. Pingback: IM Profit Formula

  67. Pingback: best harrisburg dui attorney

  68. Pingback: IntelliPlayer Review

  69. Pingback: best supplements for nitric oxide

  70. Pingback: SEO company Los Angeles

  71. Pingback: reel king slot

  72. Pingback: build my list

  73. Pingback: nordfx

  74. Pingback: click here for flagstone patio designs

  75. Pingback: gps tracker

  76. Pingback: Facebook

  77. Pingback: garcinia cambogia reviews

  78. Pingback: rewind yoyo

  79. Pingback: ship enemies glitter

  80. Pingback: play ooh aah dracula

  81. Pingback: Cloud Prospect Machine Bonus

  82. Pingback: garcinia xt and natural cleanse

  83. Pingback: My Top Tier Business Review

  84. Pingback: Onkyo TX-NR636

  85. Pingback: candellux i eglo 7i9

  86. Pingback: AVR-X4100W

  87. Pingback: dr oz diet pill garcinia cambogia

  88. Pingback: Status Labs

  89. Pingback: On

  90. Pingback: binary options nadex

  91. Pingback: HD26 Projector

  92. Pingback: check these guys out

  93. Pingback: where to sell items online,

  94. Pingback:

  95. Pingback: The

  96. Pingback: Tee Marketing Academy Review

  97. Pingback: nitric oxide best supplement

  98. Pingback: wired mouse

  99. Pingback: best nitric oxide supplements

  100. Pingback: SocialNeos

  101. Pingback: moje wesele warszawa

  102. Pingback: Onkyo TX-NR535 5.2-Channel Network A/V Receiver

  103. Pingback: foxin wins again slot machine

  104. Pingback: uk online casinos

  105. Pingback: best online casinos

  106. Pingback: Click

  107. Pingback: Video App Domination Review

  108. Pingback: clash of clans hack tool

  109. Pingback: Onkyo TX-NR838 7.2-Ch Dolby Atmos Ready Network A/V Receiver

  110. Pingback: pestovani chilli

  111. Pingback: best steroid for strength

  112. Pingback: Cocksluts of the caribeean03

  113. Pingback: Earphones

  114. Pingback: iherb coupon July 2015

  115. Pingback: Polecam

  116. Pingback: inventhelp commercials

  117. Pingback:

  118. Pingback: Onkyo TX-SR333 Review

  119. Pingback: Onkyo HT-S3700

  120. Pingback: If

  121. Pingback: Business Directory Australia

  122. Pingback: DIRECTV vs Dish

  123. Pingback: sie sucht ihn

  124. Pingback: beachside drug rehab

  125. Pingback: beachside rehab

  126. Pingback: Canadian Made Gun Parts

  127. Pingback: parking

  128. Pingback: lan penge nu 18 ar

  129. Pingback: bedste lan lige nu

  130. Pingback: Click

  131. Pingback: mp4 mobile porn

  132. Pingback: New Bingo Sites

  133. Pingback: Marcus Mariota NFL Jersey

  134. Pingback: ClickPress

  135. Pingback: Marcy ME 709

  136. Pingback: Marcy Diamond Elite

  137. Pingback: laan penge nu uden renter

  138. Pingback: distance meter

  139. Pingback: Weider Power Tower

  140. Pingback: ? F??t?r D??t

  141. Pingback: phuket rent

  142. Pingback: Online lead generation

  143. Pingback: Paginaswebtoledo

  144. Pingback: Click

  145. Pingback: 1900 Total Gym

  146. Pingback: her og nu laan

  147. Pingback: water ionizers

  148. Pingback: Brooks Brothers coupon code June 2015

  149. Pingback: Cam Sex

  150. Pingback: asian cams

  151. Pingback: Weider Ultimate Body Works Review

  152. Pingback: Youtube

  153. Pingback: Body Solid Series 7 GS348P4 Smith Machine Gym

  154. Pingback: solid gfid225

  155. Pingback: car parking

  156. Pingback: Body Champ IT8070

  157. Pingback: Ironman Gravity 4000 Inversion Table Review

  158. Pingback: harga

  159. Pingback: Stereo earbuds

  160. Pingback: powerline ppr200x power rack

  161. Pingback: Cheap Web Hosting

  162. Pingback: car phone holder

  163. Pingback: link building outsource

  164. Pingback: PowerBlock Elite 90 Review

  165. Pingback: water ionizer pay plan loans

  166. Pingback: ironmaster adjustable super bench

  167. Pingback: bottled alkaline water

  168. Pingback: ironmaster adjustable dumbbells Review

  169. Pingback: Our Webpage

  170. Pingback: pay per day loan plans

  171. Pingback: hummingbird twitter software

  172. Pingback: dedicated hosting at

  173. Pingback: rosegal promo code

  174. Pingback: Email Instruments

  175. Pingback: pandahall coupon

  176. Pingback: Facebook

  177. Pingback: Facebook

  178. Pingback: acompanhantes niteroi

  179. Pingback: If

  180. Pingback: konferencje mazury

  181. Pingback: 100k factory

  182. Pingback: Freshmaza DJ Music Download

  183. Pingback: twitter hummingbird redux

  184. Pingback: fake steel material

  185. Pingback: Marnie

  186. Pingback: when to start potty training

  187. Pingback: Rank Spy

  188. Pingback: Instant Video Machine Review

  189. Pingback: Visit

  190. Pingback: modahollister

  191. Pingback: Auto Binary Signals Pro

  192. Pingback: Cheap Flights

  193. Pingback: 7 Day Commission Formula

  194. Pingback: Insta Consultant Review

  195. Pingback: GPS Mobil

  196. Pingback: how to make money online

  197. Pingback: facial moisturizer

  198. Pingback: online tv streaming

  199. Pingback: electrician 2015

  200. Pingback: one direction quiz

  201. Pingback: click this site

  202. Pingback: al3ab banat

  203. Pingback: Roofing Milwaukee

  204. Pingback: pure garcinia

  205. Pingback: hotel unik di malang

  206. Pingback: Happy fathers day wishes

  207. Pingback: fashion pictures

  208. Pingback: Garden Bridges

  209. Pingback: al3ab banat

  210. Pingback: On

  211. Pingback: vitamin for memory

  212. Pingback: mua d?ng c? trang ?i?m

  213. Pingback: bathroom fitters Edinburgh

  214. Pingback: dui attorney york pa

  215. Pingback: Chair Gym Reviews

  216. Pingback: Dead beat Super Affiliate Reloaded Bonus

  217. Pingback: acupuncture courses

  218. Pingback: Fresh Member Review

  219. Pingback: locksmithresource

  220. Pingback: find more info

  221. Pingback: sala weselna

  222. Pingback: Facebook Marketing Software

  223. Pingback: Facebook

  224. Pingback: Sourcing Profits

  225. Pingback: WP Smart Member Bonus

  226. Pingback: plumber salary ohio

  227. Pingback: water damage restoration services

  228. Pingback: herbal remedies for ed

  229. Pingback:

  230. Pingback: sourcing profits

  231. Pingback: instant insurance

  232. Pingback:

  233. Pingback: plumber pickle walkthrough

  234. Pingback:

  235. Pingback:

  236. Pingback: dentist surbiton

  237. Pingback: click this link

  238. Pingback: workers compensation lawyer

  239. Pingback: hot girls

  240. Pingback: best dui attorney harrisburg pa

  241. Pingback: get redirected here

  242. Pingback: funeral homes in

  243. Pingback: international courier rates to canada from hyderabad

  244. Pingback: videochat bucuresti

  245. Pingback: RC Quadcopter

  246. Pingback: Video Pop Funnels

  247. Pingback: Social Page

  248. Pingback: Do you call him?

  249. Pingback: tibia gold for sale

  250. Pingback: bromo

  251. Pingback: learning about infection control

  252. Pingback: muslim astrologer

  253. Pingback: Designer

  254. Pingback: Myiparts

  255. Pingback: voice call

  256. Pingback: Email Domination Review

  257. Pingback: look these up

  258. Pingback: androgenic prohormones

  259. Pingback: local milfs

  260. Pingback: Video Flux Review

  261. Pingback: web

  262. Pingback: Viddify Bonus

  263. Pingback: showbox app download

  264. Pingback: vashikaran specialist in india

  265. Pingback: jagonya resep makanan

  266. Pingback: homeopathic dental education

  267. Pingback:

  268. Pingback:

  269. Pingback: Weebly

  270. Pingback: Frances 150cm Rundes Gartenm�belset Aluminium - 1 FRANCES Tisch + 6 ROSE St�hle g�nstig kaufen

  271. Pingback: bali bike tour

  272. Pingback: sporzadzanie deklaracji podatkowych

  273. Pingback: financial services agency

  274. Pingback: Wohnwand inkl. Highboard �STRAIGHT� Hochglanz brombeer - wei� g�nstig online kaufen

  275. Pingback: Signature - Yishun

  276. Pingback: Haartransplantation in Wien

  277. Pingback: Pioneer Elite SC-81

  278. Pingback: Venus Factor Reviews

  279. Pingback: Sony bdv-n5200w

  280. Pingback: house blue

  281. Pingback: Go Here

  282. Pingback: camping illinois

  283. Pingback: Survival Prepping Walmart

  284. Pingback: LKW-Module

  285. Pingback: Meditation Enhancement

  286. Pingback: sensory deprivation.

  287. Pingback: Explainer Videos

  288. Pingback:

  289. Pingback: amica mutual insurance company


  291. Pingback: international calling

  292. Pingback: Instagram for PC

  293. Pingback: Click

  294. Pingback: dedicated Server

  295. Pingback: electrician scissors lowes

  296. Pingback: page

  297. Pingback: steroid potency chart

  298. Pingback: wordpress

  299. Pingback: check my site

  300. Pingback: steroid addiction

  301. Pingback: mycie elewacji Warszawa

  302. Pingback: If

  303. Pingback: cure for eczema on face

  304. Pingback: ionizer loans

  305. Pingback: Geelong florist

  306. Pingback: water ionizer

  307. Pingback: Sell Tiers marketplace

  308. Pingback: payment plan

  309. Pingback: cheap vehicle parts

  310. Pingback: gi� vali k�o

  311. Pingback: JUST CLICK

  312. Pingback: Cheap Smart Watches

  313. Pingback: qwejkfdbvsdmgnscdnsgfg

  314. Pingback:

  315. Pingback: Morgan FRONCE MOUSSE Bikini marine jetzt kaufen

  316. Pingback: forskolina

  317. Pingback: teds woodworking download

  318. Pingback: ed sheeran thinking out loud

  319. Pingback: garcinia cambogias

  320. Pingback: laptopy poleasingowe laptopypoznan pl

  321. Pingback: Neuwagenkauf

  322. Pingback: eventos

  323. Pingback: Email advertising

  324. Pingback: eCom Experts Academy

Leave a Reply