Dynamic Javascript using ASP.NET MVC

Create a new MVC applictaion Open /Views/Shared/Site.Master <script src=”/Scripts/script.js” type=”text/javascript”></script> This doesn’t point to anything yet Open Global.asax Add a MapRoute routes.MapRoute(“Javascript”, “Scripts/{scriptFile}.js”, new { controller = “Scripts”, action = “Index”, scriptFile = “script” }); Now /Scripts/script.js points to Script/Index Add a view for CssController/Index <%= Url.Content(“~/Content/test.jpg”) %> Change contenttype in page directive of Views/Scripts/Index.aspx… Continue reading Dynamic Javascript using ASP.NET MVC

Dynamic CSS using ASP.NET MVC

I’ve been considering the usefulness of adding a CSS management system to my CMS that I’ve been working on. Here are the steps I’ve taken to implement it. Create a new MVC applictaion Open /Views/Shared/Site.Master <link href=”/Css/Site.css” rel=”stylesheet” type=”text/css” /> This doesn’t point to anything yet Open Global.asax Add a MapRoute routes.MapRoute(“Css”, “Css/{cssFile}.css”, new {… Continue reading Dynamic CSS using ASP.NET MVC