Stig Schmidt Nielsson
Stig Schmidt Nielsson

Reputation: 1687

How to manipulate static files served from IIS7

I have an ASP.net MVC site where I also serve some static html, js and css files from a virtual directory. Depending on the user agent of the request I want to manipulate the static html files when they are served (it is not an option to use a razor view - I need to work in the static files). Do you write an HttpHandler og an HttpModule or is there some StaticHttpHandler events that one can hook in to ?

Upvotes: 1

Views: 118

Answers (1)

usr
usr

Reputation: 171178

Write a normal controller and action. Map the appropriate route(s) to that action. You can do whatever you want in that action including reading a file, modifying the data and returning it to the HTTP client.

Upvotes: 1

Related Questions