HTTP modules can be very useful. In fact, I love them. The scope of this post is unfortunately not to explain what they are or what they do. If you're not familiar with what a HTTP module is, get an overview here and see how to create one here.
ASP.NET features some built in handlers: WebResource.axd and ScriptResource.axd. You'll see requests to these in any ASP.NET application, as they're used to serve builtin scripts for e.g. postback or client side form validation. By default, the ASP.NET application will configure these to expire from cache after a year.
Today I discovered a side effect I had not thought about. HTTP modules are loaded by the application, and are hooked into the event pipeline for each and every request handled by the ASP.NET application. In fact, this also includes requests to the WebResource.axd and ScriptResource.axd handlers!
Say you make an HTTP module that sets the cache policy for all responses — this is a nice trick to enforce a coherent cache policy for all pages across a website. Well, you just enforced your policy upon the built in handlers, which was probably not what you wanted. By default their response will be cached for an entire year, and reducing their time to live will obviously affect the load on your servers. You might even expire them immediately, forcing users to reload unchanged scripts on every page load (I know someone who did).
So, keep in mind that HTTP modules are also run for the built in handlers — or be prepared to taste the side effects.
As a final note, since we're discussing WebResource.aspx and caching: Make sure that the ASP.NET application is run with the <compilation debug="false"> setting, or else the framework will ensure that built in resources are not cached. ScottGu explains why on his blog, and one of the ASP.NET engineers elaborate further on the details of this setting on her blog.
To verifiy that the cache setting for the WebResource.axd is sane, use e.g. the Fiddler tool to inspect the response headers. You should see a date header with the current date, and an expires header with a date a year into the future, like this:
Date: Mon, 08 Nov 2010 14:57:24 GMT
Expires: Tue, 08 Nov 2011 14:57:24 GMT
Happy caching.
Software security blog by André N. Klingsheim, who's learning to love .NET and Microsoft servers.
Nov 8, 2010
Subscribe to:
Post Comments (Atom)
Copyright notice
© André N. Klingsheim and www.dotnetnoob.com, 2009-2018. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to André N. Klingsheim and www.dotnetnoob.com with appropriate and specific direction to the original content.

Read other popular posts
-
Microsoft's widely used e-mail service Hotmail was recently overhauled and rebranded Outlook.com. One of the less known services they pr...
-
The .NET 4.5 framework was released a couple of months ago and it included several improvements in the security area. To benefit from these ...
-
Though Windows Server 2003 has been around for a while, we'll still see them around the Internet for many years to come. Despite their u...
-
OWASP recently released their Top Ten 2013 list of web application vulnerabilities. If you compare the list to the 2010 version you’ll see t...
-
Security headers in an HTTP response There are many things to consider when securing a web application but a definite "quick win&qu...
-
Yesterday I was playing around with the validateIntegratedModeConfiguration="true" setting on IIS 7.5. To my surprise I got an ...
-
Just a quick note on an error I often run into when I'm working on my Azure applications. I usually create Azure packages and upload the...
-
Recently I wrote a piece of software that needed some configurable secrets — and they needed to be VERY secret. Consequently, I had to encry...
-
I guess it was long overdue for me to follow up on my Hardening Windows Server 2003 SSL/TLS configuration and Windows server 2003 vs 20...
-
I just discovered that Facebook reveal to search engines the users who "Like" a page , regardless of their privacy settings. Try a...

It's a good trick to set cache expiration to "infinite" and instead use a version number in the query string to the resource. Then for each new version the users with the old outdated resource will immediately fetch the new resource from the server. If a resource lives for a long time without being changed then users never have to refetch it for that time.
ReplyDeleteThe page that references the resources either is always expired, or has a very short expiration.
Ex: <script src="myfile.js?version=1"></script>
You're right! This is essentially what happens for resources served by WebResource.axd.
ReplyDeleteAwesome post, I learned something new today! I just forwarded your post to the BlogEngine.Net team as something they should be aware of.
ReplyDeleteI'm glad to hear that you found this information useful!
ReplyDeletecolumbia outlet
ReplyDeletekobe shoes
michael kors uk
scarpe hogan
louis vuitton outlet
nike roshe run pas cher
mbt shoes
pandora jewelry
canada goose jackets
louis vuitton handbags
chenlina20170421
20170518 leilei3915
ReplyDeletemont blanc pens
pandora charms
coach factory outlet
michael kors handbags
lacoste shirts
mlb jerseys wholesale
polo shirts
michael kors outlet clearance
cheap mlb jerseys
ugg boots
Really good thank for sharing.
ReplyDeleteหวยออนไลน์
ทางเข้า sbobet
ทางเข้า m8bet
goldenslot
You can find a lot of helpful info in the Internet. For me https://essaydragon.com/blog/creative-essay-writer is very important, cause I'm a writer.
ReplyDeletewaoooo Sooo Niceeee. I really like it. Minecraft apk Hay Day mod apk
ReplyDeletesurveillancekart security system
ReplyDeletesurveillancekart cctv installation services
cp plus
Pestveda pest control services
dezigly
The feedgasm Latest News And Breaking News
quicksodes
latest news in hindi
nice one
ReplyDeleteThanks for sharing
ReplyDeleteThis is very nice helpful, thanks for sharing
ReplyDeletehttps://apkpure.com
Apkpure.site
rootmaster.site
useful website
global shopaholics
ReplyDeletedoes amazon ship to saudi arabia
Great Article
ReplyDeleteIEEE Projects on Information Security
Project Centers in Chennai
JavaScript Training in Chennai
JavaScript Training in Chennai
curry shoes
ReplyDeletelebron 16
nike shox
curry 5 shoes
jordan shoes
kobe byrant shoes
nike epic react flyknit
yeezy boost
ferragamo belt
birkin bag
I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update. Thanks
ReplyDeleteDedicatedHosting4u.com
I am overwhelmed by your post with such a nice topic. Usually, I visit your blogs http://kitestep.com/ and get updated with the information you include but today’s blog would be the most appreciable...
ReplyDeleteThanks
Cpa offers
From our custom affordable term papers, students can hire the best writers and be assured to receive the best custom papers when they search purchase custom research paper written by experts.
ReplyDeleteA well-written Literature Review for Dissertation contains a title, abstract, introduction, literature review, methods, results, discussion and references. The company offers Research Paper Writers for Hire to the Customers.
ReplyDeleteI am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts.
ReplyDeleteCyber Security Projects for Final Year
JavaScript Training in Chennai
Project Centers in Chennai
JavaScript Training in Chennai
An exceptional Buy College Research Paper will ensure that the client gets only the best quality Best Writing Services work that meets the standards of the Dissertation Writing Services.
ReplyDeleteสมัคร goldenslot ได้ที่นี่
ReplyDeletegoldenslot
สมัคร goldenslot
โกลเด้นสล็อต
This article makes life happy, bright and gives good ideas.
ReplyDeleteSa gaming สมัคร
https://belutlistrik.com/
ReplyDeletepaito warna sydney
paito warna sgp
kingdom4d
Togel Online
http://livesydney.website/
bandar togel
https://masterwla.com/
http://tabelpaito.net/
http://62.171.145.61/anugerahtoto/
ReplyDeleteTogel Online
Poker Online
bandarq
Bandar Kometqq
capsa online
agen online qq
agen poker
pelangiqq
ReplyDeletepelangiqq
pelangiqq
pelangiqq
pelangiqq
pelangiqq
pelangiqq
pelangiqq
https://togelhoky1.blogspot.com/
ReplyDeletehttps://togelresmi8.blogspot.com/
https://togelsgphk8.blogspot.com/
https://situstogelkita.blogspot.com/
https://togelonlinejudi.blogspot.com/
https://togel2020wap.blogspot.com/
There are academic nursing writing help companies whose ultimate goal is to provide Help with Nursing Writing Services since they are aware most nursing essay writing service part-time students lack enough time to complete their college custom nursing assignments.
ReplyDeleteProfessional History Research Paper Services is very popular for students in search for history essay writing help services and history assignment writing services.
ReplyDeleteMany new website owners face http related issues because they have not enough knowledge about it. I will suggest that they should contact with seniors and solve this issue. Dissertation proposal writing services.
ReplyDeleteIf you are looking for the Non-plagiarized Research Papers Online then get connected with Custom Research Writing Services and get your research done on time. You can also purchase Pre-written Research Papers that will leave an impression.
ReplyDeleteAgain, I am very tired of Joe Biden. Not because I am a purist, or have inflexible ideological commitments of what Coach Outlet it will take to remove Coach Outlet Store Donald Trump from office. But rather because Biden's condescension towards black communities is intolerable.I want to believe that Biden's condescension started after the respected Representative James Clyburn called Ray Ban Outlet the former vice president an "honorary black man" at a private dinner in March.
ReplyDeleteThe carbon structure and the taphonomic mode associated with these films were investigated using Raman spectroscopy. Our analysis confirms that these reflective films are kerogenous, showing a higher D1 Coach Handbags Clearance (disordered) band and G (graphite) band intensity and area, indicating a greater concentration of Yeezy Boost 350 Ray Ban Glasses disordered carbon compared to the surrounding matrix. The spectral characteristics of the fossils denote moderately ordered New Jordan Shoes 2020 kerogenous matter, indicating that the transitional Buen Formation that hosts the Sirius Passet was thermally Yeezy Discount altered at a peak temperature of 409 50 C.
In earlier eras, these were reflected through sitcoms, light family comedies, late century Updike novels. When we had free range children, a kid's weekend would begin a lot like that image of John Wayne in "The Searchers," hovering at the front door, an expanse of land before them. Then, at least since the 1970s John Carpenter's "Halloween," say our image of American front lawns became less benign..
ReplyDeleteJust basically didn have, he didn know how to tell other people what to do and how to command, I felt, Lout said. Didn't think he was the man for the job then, I don't think he's the man for the Coach Outlet Online job now. As far as it being a black or white issue, I pushed for a white and I pushed for Cheap Michael Kors Handbags a black man as candidates for that job.
The Zeiss VR One Plus headset is comfortable Nike Air Force 1 Cheap Outlet to wear, lightweight, and Jordan Shoes For Sale you can still Ray Ban Outlet wear your Coach Outlet Clearance Sale prescription glasses. MK Outlet Online One of the best features is that there is a universal smartphone tray, which means you Best Yeezys can use most phones (from 12 to 14cm). The lenses are quality Zeiss glass, but image quality is limited both by your phone and the app you using...
Nice blog amazing post
ReplyDeletehttps://etisalatspeedtest.site
etisalat Wifi speed test tool
etisalat monthly packages 2021
Thanks for sharing
ReplyDeletehttps://ptclspeedtests.info
ptcl speed test
ptcl internet packages rates
Đặt mua vé masybay giá rẻ tại Aivivu, tham khảo
ReplyDeletemua ve may bay di my
khi nào có vé máy bay từ mỹ về việt nam
chuyến bay từ anh về việt nam
chuyến bay từ pháp về việt nam