Disclaimer

Any opinions expressed here are my own and not necessarily those of my employer (I'm self-employed).

Nov 8, 2010

Lesson learned: HTTP modules can also affect WebResource.axd

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.

94 comments:

  1. 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.

    The page that references the resources either is always expired, or has a very short expiration.

    Ex: <script src="myfile.js?version=1"></script>

    ReplyDelete
  2. You're right! This is essentially what happens for resources served by WebResource.axd.

    ReplyDelete
  3. Awesome post, I learned something new today! I just forwarded your post to the BlogEngine.Net team as something they should be aware of.

    ReplyDelete
  4. I'm glad to hear that you found this information useful!

    ReplyDelete
  5. 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.

    ReplyDelete
  6. I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update. Thanks
    DedicatedHosting4u.com

    ReplyDelete
  7. 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...

    Thanks
    Cpa offers

    ReplyDelete
  8. 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.

    ReplyDelete
  9. A 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.

    ReplyDelete
  10. I 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.
    Cyber Security Projects for Final Year

    JavaScript Training in Chennai

    Project Centers in Chennai

    JavaScript Training in Chennai

    ReplyDelete
  11. 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
  12. This article makes life happy, bright and gives good ideas.
    Sa gaming สมัคร

    ReplyDelete
  13. 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.

    ReplyDelete
  14. Professional History Research Paper Services is very popular for students in search for history essay writing help services and history assignment writing services.

    ReplyDelete
  15. Many 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.

    ReplyDelete
  16. If 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.

    ReplyDelete
  17. Again, 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.

    The 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.

    ReplyDelete
  18. 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..

    Just 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...

    ReplyDelete
  19. Thank a lot. You have done excellent job. I enjoyed your blog . Nice efforts
    Data Science Certification in Hyderabad

    ReplyDelete
  20. Awesome article. I enjoyed reading your articles. this can be really a good scan for me. wanting forward to reading new articles. maintain the nice work!
    Data Science Courses in Bangalore

    ReplyDelete
  21. I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
    Business Analytics Course in Bangalore

    ReplyDelete
  22. Wow, happy to see this awesome post. I hope this think help any newbie for their awesome work and by the way thanks for share this awesomeness, i thought this was a pretty interesting read when it comes to this topic. Thank you..
    Artificial Intelligence Course

    ReplyDelete
  23. Excellent Blog! I would like to thank you for the efforts you have made in writing this post. Gained lots of knowledge.
    Data Analytics Course

    ReplyDelete
  24. What an incredible message this is. Truly one of the best posts I have ever seen in my life. Wow, keep it up.
    AI Courses in Bangalore

    ReplyDelete
  25. I need to thank you for this very good read and i have bookmarked to check out new things from your post. Thank you very much for sharing such a useful article and will definitely saved and revisit your site.
    Data Science Course

    ReplyDelete
  26. Your site is truly cool and this is an extraordinary moving article and If it's not too much trouble share more like that. Thank You..
    Digital Marketing Course in Hyderabad

    ReplyDelete
  27. Watch live action from the 2021 Tokyo Olympic Games, check TV listings and event schedules on NBCOlympics.com.Olympic Live Streams - TV Listings and Schedule

    ReplyDelete
  28. Wonderful blog found to be very impressive to come across such an awesome blog. I should really appreciate the blogger for the efforts they have put in to develop such amazing content for all the curious readers who are very keen on being updated across every corner. Ultimately, this is an awesome experience for the readers. Anyways, thanks a lot and keep sharing the content in the future too.

    Digital Marketing Training in Bangalore

    ReplyDelete
  29. Truly incredible blog found to be very impressive due to which the learners who go through it will try to explore themselves with the content to develop the skills to an extreme level. Eventually, thanking the blogger to come up with such phenomenal content. Hope you arrive with similar content in the future as well.

    Machine Learning Course in Bangalore

    ReplyDelete
  30. I found Habit to be a transparent site, a social hub that is a conglomerate of buyers and sellers willing to offer digital advice online at a decent cost.

    Artificial Intelligence Training in Bangalore

    ReplyDelete
  31. I bookmarked your website because this site contains valuable information. I am very satisfied with the quality and the presentation of the articles. Thank you so much for saving great things. I am very grateful for this site.

    Data Science Training in Bangalore

    ReplyDelete
  32. You have done excellent job Thanks a lot and I enjoyed your blog. Great Post.
    Data Science Certification in Hyderabad

    ReplyDelete
  33. Great post happy to see this. I thought this was a pretty interesting read when it comes to this topic Information. Thanks..
    Artificial Intelligence Course

    ReplyDelete
  34. Nice Post thank you very much for sharing such a useful information and will definitely saved and revisit your site and i have bookmarked to check out new things frm your post.
    Data Science Course

    ReplyDelete
  35. Thanks Your post is so cool and this is an extraordinary moving article and If it's not too much trouble share more like that.
    Digital Marketing Course in Hyderabad

    ReplyDelete
  36. A good blog always contains new and exciting information and as I read it I felt that this blog really has all of these qualities that make a blog.

    Data Science Training in Bangalore

    ReplyDelete
  37. I am more curious to take an interest in some of them. I hope you will provide more information on these topics in your next articles.

    Machine Learning Course in Bangalore

    ReplyDelete
  38. It is late to find this act. At least one should be familiar with the fact that such events exist. I agree with your blog and will come back to inspect it further in the future, so keep your performance going.

    Digital Marketing Training in Bangalore

    ReplyDelete
  39. You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.

    Artificial Intelligence Training in Bangalore

    ReplyDelete
  40. I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
    Business Analytics Course in Bangalore

    ReplyDelete
  41. What an incredible message this is. Truly one of the best posts I have ever seen in my life. Wow, keep it up.
    AI Courses in Bangalore

    ReplyDelete

  42. I am really enjoying reading your well written articles. I am looking forward to reading new articles. Keep up the good work.
    Data Science Courses in Bangalore

    ReplyDelete
  43. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    Data Analytics Course

    ReplyDelete
  44. I recently came across your article and want to express my admiration for your writing skills and your ability to get readers to read from start to finish.
    AWS Course in Hyderabad

    ReplyDelete
  45. Informative Post. The information you have posted is very useful and sites you have referred was good. Thanks for sharing.
    Data Science Course with Placement

    ReplyDelete
  46. Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.

    Data Science in Bangalore

    ReplyDelete
  47. I just got to this amazing site not long ago was actually captured with the piece of resources you have got here and big thumbs up for making such wonderful blog page!
    Data Scientist Course

    ReplyDelete
  48. Very informative blog! There is so much information here that can help thank you for sharing.
    Data Science Syllabus

    ReplyDelete
  49. Very nice job... Thanks for sharing this amazing and educative blog post!
    Data Science Training in Lucknow

    ReplyDelete
  50. Good blog and absolutely exceptional. You can do a lot better, but I still say it's perfect. Keep doing your best.

    Data Science Training in Nagpur

    ReplyDelete
  51. Very good message. I stumbled across your blog and wanted to say that I really enjoyed reading your articles. Anyway, I will subscribe to your feed and hope you post again soon.
    Data Scientist Course in India

    ReplyDelete
  52. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. Keep up the good work. Waiting for your next article
    Data Science Course in Jabalpur

    ReplyDelete
  53. Nice Post i have read this article and if I can I would like to suggest some cool tips or advice and perhaps you could write future articles that reference this article. I want to know more!
    Data Analytics Course in Gurgaon

    ReplyDelete
  54. Very informative Blog! There is so much information here that can help thank you for sharing.
    Data Analytics Training in Bangalore

    ReplyDelete
  55. This is an informative and knowledgeable article. therefore, I would like to thank you for your effort in writing this article.
    Data Science Course in Bangalore

    ReplyDelete
  56. This is an informative and knowledgeable article. therefore, I would like to thank you for your effort in writing this article.
    Data Scientist Course in Lucknow

    ReplyDelete
  57. I really appreciate this wonderful message you have given us. I assure you that would be beneficial for most people.

    Data Analytics Course in Nagpur

    ReplyDelete
  58. Very good message. I stumbled across your blog and wanted to say that I really enjoyed reading your articles. Anyway, I will subscribe to your feed and hope you post again soon.
    Mlops Training

    ReplyDelete
  59. There is obviously a lot to know about this. I think you made some good points in Features also. Great job!
    Data Science Course in Jalandhar

    ReplyDelete

  60. This is an informative and knowledgeable article. therefore, I would like to thank you for your effort in writing this article.
    Business Analytics Course in Chandigarh

    ReplyDelete
  61. Hello. I found your blog using msn. This is a very well written article. I'll be sure to bookmark it and come back for more useful information. Thanks for the post. I will definitely be back.

    Data Science Training in Bangalore

    ReplyDelete
  62. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. Keep up the good work. Waiting for your next article
    Business Analytics Course in Jabalpur

    ReplyDelete
  63. Very informative Blog! There is so much information here that can help thank you for sharing.
    Data Analytics Course in Bangalore

    ReplyDelete
  64. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Thanks for sharing.
    Data Science Training in Indore

    ReplyDelete
  65. Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.

    Data Science Training Institutes in Bangalore

    ReplyDelete
  66. I think this is a really good article. You make this information interesting and engaging. Thanks for sharing.
    Data Science Course in India

    ReplyDelete
  67. I am excited about this blog. It is an informative subject. It helped me a lot in solving some problems. Your opportunity is so fantastic and the style of work so fast.

    Data Science Training in Ernakulam

    ReplyDelete
  68. I am overwhelmed by your post with such a beautiful subject. I usually visit their blogs and update myself through the information they contain, but today's blog would be most appreciated. Well done!

    Business Analytics Course in Durgapur

    ReplyDelete
  69. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Thanks for sharing.
    Data Scientist Course in Jabalpur

    ReplyDelete
  70. Some really good points you wrote here ... Great things ... I think you raised some really interesting points. Keep up the good work.

    Best Data Analytics Courses in Bangalore

    ReplyDelete
  71. So luck to come across your excellent blog, glad i found it. Keep posting new articles. Good luck.
    Data Science Course Details

    ReplyDelete
  72. 최고의 메이져 먹튀검증 이곳에서 즐기세요

    ReplyDelete
  73. The new wave of innovation that is changing the way people do business is called data science. Gain expertise in organizing, sorting, and transforming data to uncover hidden patterns Learn the essential skills of probability, statistics, and machine learning along with the techniques to break your data into a simpler format to derive meaningful information. Enroll in Data science in Bangalore and give yourself a chance to power your career to greater heights.
    Data Science Certification in Bangalore

    ReplyDelete

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