I have a big Javascript file generated dynamically from a method in a Controller.
public ActionResult GetEditingContext()
{
string json = JsonConvert.SerializeObject(...);
return JavaScript(json);
}
The javascript is almost always the same, but the user can change settings in the admin panel and the javascript should be updated. I thought that a ScriptBundle would be perfect to handle that. It would automatically check if the content has changed and update the url for the script.
The problem is that I don't know how to include a URL in a bundle.
I tried this :
bundles.Add(new TsBundle("~/bundles/editContext").Include(
"~/Invoice/GetEditingContext"));
But the generated script bundle is empty, and has no hash. If I remove the ~ I get an exeption (Only application relative URLs (~/url) are allowed.)