views:

252

answers:

1

I'm trying to do something seemingly simple: ensure that Application_BeginRequest is called for every static *.JS URL sent to my IIS6 website, whether or not the underlying file exists.

What's a good way to do this on IIS6 & ASP.NET 3.5, ideally without causing all static files to go through ASP.NET-- only the .JS URLs?

If you're curious about why, I'm working with an existing app that uses Application_BeginRequest to do custom redirection and path rewriting. It woudln't have been my first choice to implement it this way, but given what's there I want to extend it to cover .JS too, instead of including another different redirection/rewrite method (e.g. IIS redirection configuration, a rewrite module, etc.) which may complicate deployments and testing of the app, especially on IIS6.

I know the IIS7 story here is much, much better (esp. around XCOPY deployment of configuration, modules, etc.), but I can't upgrade this app right now.

A: 

I haven't tested this, but in IIS Manager, on the properties of your site click the Home Directory tab, and click configuration - add a .js extension that maps to aspnet_isapi. Make sure you uncheck the "Verify file exists" checkbox. You might need to play around with the other options.

Andy Gaskell
I tried this earlier but didn't see any calls to Application_BeginRequest happening. But it's possible that calls were happening and I had some other problem going on. I'll recheck.
Justin Grant