.NET Generic Handlers and a Pain in the Neck

2010/03/31 at 16:18 Leave a comment

I’m using Microsoft Virtual Earth to map locations for a project that I’m working on. This is all fine and good. I’m using a GeoRSS feed to populate points on my map with code like this:


The issue here, is that my ashx handler that was providing the GeoRSS feed was somehow being cached. So updates to data would NOT be reflected on the GeoRSS feed until I closed and opened the browser window. This was not good.

Enter Response Headers:

context.Response.Headers.Add("Pragma", "no-cache")
context.Response.Headers.Add("Cache-Control", "no-cache")

I’m saved right? Not a chance. Using the above syntax will result in an exception to the effect of “Requires IIS integrated pipeline mode” Turns out that this is an IIS 7.0 ONLY feature; this is not supported on IIS 6, what I’m using since there is no IIS 7.0 for Windows Server 2003.

A quick swap from

context.Response.Headers.Add("Pragma", "no-cache")
context.Response.Headers.Add("Cache-Control", "no-cache")


context.Response.AddHeader("Pragma", "no-cache")
context.Response.AddHeader("Cache-Control", "no-cache")

and you’re all set.

I’m still kinda peeved that .Net does not account for the operating system (and thus IIS version) and adjust the call accordingly. I thought one of the reasons for .Net was to write ONE VERSION of your application and deploy to ANY operating system, and provided you did not use any [DllImports] your application was supposed to work. Overall, still very happy with .Net but kinda peeved about this one.


Entry filed under: Uncategorized.

Understanding how I learned, to keep learning better Developing for Windows Phone 7, thoughts after a few months on task

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

My Most Recent Updates

  • Doing a bit of well overdue digital housekeeping. Deleting resource groups and app services left and right! 1 week ago
  • Just finished migrating all my CodePlex projects to GitHub. Bitter sweet, my first OSS contributions were on CodePlex, but its for the best. 1 week ago
  • RT @arstechnica: "These idiots run directly up to your armed-to-the-teeth hero and attack one-at-a-time—like a bad Chuck Norris film" https… 1 week ago
  • VSTS has got some nice stuff going on with Build and Release management. Makes deployments as easy as pie. 1 week ago
  • Suffering from lots of self inflicted minor obstacles, on something I know how to do a different way starting to annoy me. 1 week ago
  • @DrPizza They could at least smooth out the animation on those cogs. Two frames seems awfully low, even for a system update screen. 1 month ago
  • RT @Jimminy: *golf claps* to @apple for focusing all their efforts on making design and usability worse across both hardware and software f… 6 months ago
  • RT @AdamJosephCook: @trevorghess @natebross Indeed. I do not understand why @Meetup is not more prompt about this. The events are clearly j… 6 months ago
  • @trevorghess any word on the coup for the azure meetup group? 7 months ago
  • feedback-hub:?contextid=67&feedbackid=81903edf-4b95-406b-b263-58464bc30744&form=1&src=1 https://t.co/lnRSeFZzI4 10 months ago

%d bloggers like this: