ASP.NET MVC2: How to include js script/resource files compiled into dll?

Is there a way in ASP.NET MVC to reference the resource files compiled into dll on the master/view? I'm looking for something similar to the ASP.NET way:

Page.ClientScript.GetWebResourceUrl(typeof(PageType), "ResourceName")

I'm converting a custom asp server control to MVC html helper. It relies on some js script and I'd hate to tell the client "oh, and just include this file as a script on this page".

ANY kind of help (or even thoughts) would be highly appreciated :)


You could have your controller return content that the browser believes is a JavaScript file. If all of the code to render the JavaScript file is in the controller then it would be rolled up into your app's DLL.

I've done this with CSS having the controller return a view that has a content type of "text/css". I'm sure the technique could be applied here as well.

Need Your Help

How do I bind ListPicker to collection of TimeSpan?

windows-phone-7 windows-phone xaml-binding

I'm trying to bind my ListPicker to the TimeSpan.Days property in an ObservableCollection, I'm also using a Converter to format the string, but I cannot get the binding to work. I don't get any err...