Click here to Skip to main content
12,764,163 members (40,104 online)
Click here to Skip to main content


78 bookmarked
Posted 4 Feb 2009

ASP.NET Custom Control for High Performance Web Scripts

, 13 May 2009 CPOL
Presents a custom control replacement for the script tag that optimizes JavaScript for web pages. Automatically merges, prevents duplicates, externalizes, orders, adds expires headers, caches, minifies, and places your scripts.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DependenciesTest.aspx.cs" Inherits="HighPerformanceScript.Tests.DependenciesTest" %>
<%@ Register TagPrefix="HP" Assembly="HighPerformanceScript" Namespace="HighPerformanceScript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
  <title>Dependencies Test Page</title>
  <form id="form1" runat="server">
    Tests to make sure that two scripts are added when only a single tag is presented but dependencies are declared in that file.<br />
    <HP:Script Src="DependenciesScript2.js" runat="server" />
    <span id="Script1Target" style="background-color: red;">FAIL</span> Prerequisite Script 1 included and executed.<br />
    <span id="Script2Target" style="background-color: red;">FAIL</span> Declared Script 2 included and executed.<br />
    Tests to make sure that two scripts with a dependency are both included in the correct, even if they are both included in wrong order in HTML.<br />
    <HP:Script Src="DependenciesScript4.js" runat="server" />
    <HP:Script Src="DependenciesScript3.js" runat="server" />
    <span id="Script3Target" style="background-color: red;">FAIL</span> Prerequisite Script 3 included and executed.<br />
    <span id="Script4Target" style="background-color: red;">FAIL</span> Declared Script 4 included and executed.<br />

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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Adrian Akison
Team Leader Zuuse Pty Ltd
Australia Australia
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.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 13 May 2009
Article Copyright 2009 by Adrian Akison
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid