|
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
namespace HighPerformanceScript {
/// <summary>
/// Page that will render JavaScript to the browser from the Script
/// tags cache of aggregated scripts.
/// </summary>
public partial class ScriptResource : System.Web.UI.Page {
/// <summary>
/// Override the render to output the aggregated script from the Script control,
/// setting MIME type and Expires header in the process.
/// </summary>
protected override void Render(HtmlTextWriter writer) {
string filename = Request["File"];
Script.ScriptOutput output = Script.ScriptOutput.Minified;
if(Request["Output"] == "Full") {
output = Script.ScriptOutput.Full;
}
string content = Script.GetJavaScriptContent(filename, output);
Response.ContentType = "text/javascript";
Response.ExpiresAbsolute = DateTime.Now.AddYears(1);
writer.Write(content);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have been a professional software developer for twenty years, starting with C++ and migrated to C#. While I have transitioned into full time management, writing code is still my passion. As I don't write code for work very often, I have had the opportunity to apply my programming skills as a hobby where I have recently authored two Windows 8 store apps. First, an Asteroids tribute game, 'Roid Rage and most recently Shared Whiteboard (which does what it says).
I make a habit of contributing production code to every project I run. Most notably, I have recently run teams to build The Navigator for The Advertiser newspaper and Street Lights Out for SA Power Networks.