<

Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

Reduce the Page size Asp.Net

Published on
12,125 Points
5,625 Views
5 Endorsements
Last Modified:
Approved
Problem

Hi all,

   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.


Solution

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

<!--
      ‘****
     ‘code
--> 

Open in new window


 To
<%--
‘code
--%> 

Open in new window


2.  Remove any inline JavaScript , Create a external .js file and Call in the aspx

3   Explicitly Call Dispose or Close on Resources You Open

Try
  conn.Open()
…Finally
  If Not(conn Is Nothing) Then
    conn.Close()
  End If
End Try

Open in new window


4. Ensure Debug Is Set to False
<%@ Page [b]debug="false"[/b] ... %>

Open in new window


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;
            }
        }

Open in new window

8. URL Mapping

    url mapping facility to change the long url to shorter url and reduce the page size like below in coding

Example 1
      ../Applications/IconViewer.aspx       to      ../vwr.aspx
Example 2
             /domain/ApplicationLauncher.aspx     to      /domain/lau.aspx

 In web.config
<system.web>
            <pages validateRequest="false">

                                 <urlMappings enabled="true">
                  <add url="~/vwr.aspx" mappedUrl="~/Application/IconViewer.aspx"/>
                  <add url="~/lau.aspx" mappedUrl="~/domain/Launcher.aspx"/>
            </urlMappings>


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

11. While launch the application javascript window.open is used instead of that move the reusable coding and call the JS function

12. Remove the target window name from the link and control that too in javascript function

More details :
http://msdn.microsoft.com/en-us/library/ms998549.aspx


Conclusion
Reducing page size will enable faster download but page size is not only area where you need to look.
5
Comment
1 Comment
 
LVL 29

Author Comment

by:Kumaraswamy R
Reduce the Page size Asp.Net
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Join & Write a Comment

Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month