In most application projects there is the problem of performance. The reason of low rendering web applications can be diagnose in two aspects. Firstly, it is time of response generation and secondly is downloading a generated content to a client. In case, when your application works quite good in develop environment but after deploy it works much worse, most likely the reason of it is time needed to send a content of page from a server to a client.
To diagnose this type of problem you can use YSlow. It is a Firefox add-on integrated with the popular Firebug web development tool.
The tips which help you reduce a response size.
1. You can turn off the view state in some controls(EnableViewState="False")
2. You can move some layout properties form inline definition to class definition. For example, when you have 100 TextBoxs, which have set width, background, font,… You can create a CSS class for the TextBoxes where you can move common properties.
3. Implementing HTTP gzip/deflate compression in Global.asax can gives you quite good effect.
void Application_BeginRequest(object sender, EventArgs e)
{
HttpCompress((HttpApplication)sender);
}
private void HttpCompress(HttpApplication app)
{
string accept = app.Request.Headers["Accept-Encoding"];
if (accept != null && accept.Length > 0)
{
if (CanCompressScript(Request.ServerVariables["SCRIPT_NAME"]))
{
Stream stream = app.Response.Filter;
accept = accept.ToLower();
if (accept.Contains("gzip"))
{
app.Response.Filter = new GZipStream(stream, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}
else if (accept.Contains("deflate"))
{
app.Response.Filter = new DeflateStream(stream, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "deflate");
}
}
}
}
private bool CanCompressScript(string scriptName)
{
if (scriptName.ToLower().Contains(".aspx")) return true;
if (scriptName.ToLower().Contains(".axd")) return false;
if (scriptName.ToLower().Contains(".js")) return false;
return true;
}