While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.
If your ASP.NET page is heavy and will take some time to load, you risk that the user will close browser window or go to some faster web site.
Let we see how to possible to reduce size of page without removing useful content.
1. Change the Comment Line Client side to Server side in the aspx
3 Explicitly Call Dispose or Close on Resources You Open
If Not(conn Is Nothing) Then
4. Ensure Debug Is Set to False
<%@ Page [b]debug="false"[/b] ... %>
5 Remove any inline Style class, Create a external .CSS file and Call in the aspx
6 Set EnableViewState="false" for label in the Aspx page
[ If no need the viewstate value any control - set EnableViewState="false" ]
7 Disable the View State in server side for Datagrid Bound select columns
private void Page_PreRender(object sender, System.EventArgs e)
foreach (DataGridItem dgi in dgdItemList.Items)
dgi.Cells[ID].EnableViewState = false;
dgi.Cells[ItemUD].EnableViewState = false;
dgi.Cells[DateCreated].EnableViewState = false;
dgi.Cells[Subject].EnableViewState = false;
8. URL Mapping
url mapping facility to change the long url to shorter url and reduce the page size like below in coding
../Applications/IconViewer.aspx to ../vwr.aspx
/domain/ApplicationLauncher.aspx to /domain/lau.aspx
<add url="~/vwr.aspx" mappedUrl="~/Application/IconViewer.aspx"/>
<add url="~/lau.aspx" mappedUrl="~/domain/Launcher.aspx"/>
9. In html table, every TR, For every TD, width is specified. Normally browsers won’t render the TD for each row differently It only consider about the first row TDs. So only set width for the first row TDs
10 .Default TD alignment is left.So the attribut align=left removed
More details :
Reducing page size will enable faster download but page size is not only area where you need to look.