You can do something like this by writing a custom handler for your javascript files. In the Web.Config file of your MVC project, find the httpHandlers section. Add something like the following line:
<add verb="GET" path="/YourScriptsFolder/*.js" type="Your.Project.Namespace.And.Custom.Handler, Your.Assembly.Name" validate="false" />
This will force all requests for js files in this folder through your custom handler, which will look something like this:
class CustomHandler : IHttpHandler { #region IHttpHandler Members public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext context) {
I have not tested this code so you might run into some problems, but this is the main idea. There are many examples of ASP.Net custom handlers all over the Internet. Here is a good example:
http://www.developer.com/net/asp/article.php/3565541/Use-Custom-HTTP-Handlers-in-Your-ASPNET-Applications.htm
source share