Best Practices for Speeding Up Your Web Site

Today I found a greate article for  best practices for making web pages fast.The list includes 34 best practices divided into 7 categories.

 1) Content

    * Minimize HTTP Requests
    * Reduce DNS Lookups
    * Avoid Redirects
    * Make Ajax Cacheable
    * Post-load Components
    * Preload Components
    * Reduce the Number of DOM Elements
    * Split Components Across Domains
    * Minimize the Number of iframes

2) Server

    * Use a Content Delivery Network
    * Add an Expires or a Cache-Control Header
    * Gzip Components
    * Configure ETags
    * Flush the Buffer Early
    * Use GET for AJAX Requests

3) CSS

    * Put Stylesheets at the Top
    * Avoid CSS Expressions
    * Choose over @import
    * Avoid Filters

4) Javascript

    * Put Scripts at the Bottom
    * Make JavaScript and CSS External
    * Minify JavaScript and CSS
    * Remove Duplicate Scripts
    * Minimize DOM Access
    * Develop Smart Event Handlers

5) Cookie

    * Reduce Cookie Size
    * Use Cookie-free Domains for Components

6) Images

    * Optimize Images
    * Optimize CSS Sprites
    * Don’t Scale Images in HTML
    * Make favicon.ico Small and Cacheable

7) Mobile

    * Keep Components under 25K
    * Pack Components into a Multipart Document

For details check out this


How to Programmatically add JavaScript File to Asp.Net page?

In this post I will show you how to add JavaScript files programmatically  to your page. 

Just add this code to the Page_Init event handler on your page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Blog_Tips.aspx.cs" Inherits="Blog_Tips" %>

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

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        How to Programmatically add JavaScript File to Asp.Net page?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class Blog_Tips : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)


    protected void Page_Init(object sender, EventArgs e)
        HtmlGenericControl javascript = new HtmlGenericControl("script");
        javascript.Attributes["type"] = "text/javascript";
        javascript.Attributes["src"] = "Scripts/jquery-1.3.2.min.js";