Document for Reduce the Page -Asp.Net

AID: 7249
  • Status: Published

1330 points

  • Byrkworlds
  • TypeTips/Tricks
  • Posted on2011-08-24 at 00:21:37
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
--> 
                                    
1:
2:
3:
4:

Select allOpen in new window



 To
<%--
‘code
--%> 
                                    
1:
2:
3:

Select allOpen 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
                                    
1:
2:
3:
4:
5:
6:
7:

Select allOpen in new window



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

Select allOpen 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;
            }
        }
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:

Select allOpen 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.
Asked On
2011-08-24 at 00:21:37ID7249
Tags

Document for Reduce the Page -Asp.Net

Topic

.NET

Views
628

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top .NET Programming Experts

  1. CodeCruiser

    588,856

    Sage

    6,000 points yesterday

    Profile
    Rank: Genius
  2. kaufmed

    377,702

    Wizard

    10 points yesterday

    Profile
    Rank: Genius
  3. BuggyCoder

    268,007

    Guru

    1,600 points yesterday

    Profile
    Rank: Sage
  4. TheLearnedOne

    232,552

    Guru

    4,900 points yesterday

    Profile
    Rank: Savant
  5. Idle_Mind

    193,005

    Guru

    0 points yesterday

    Profile
    Rank: Savant
  6. JamesBurger

    156,812

    Guru

    2,000 points yesterday

    Profile
    Rank: Sage
  7. wdosanjos

    124,308

    Master

    2,000 points yesterday

    Profile
    Rank: Genius
  8. Dhaest

    115,720

    Master

    0 points yesterday

    Profile
    Rank: Genius
  9. sedgwick

    112,918

    Master

    1,600 points yesterday

    Profile
    Rank: Genius
  10. nepaluz

    101,325

    Master

    0 points yesterday

    Profile
    Rank: Sage
  11. MlandaT

    95,921

    Master

    2,100 points yesterday

    Profile
    Rank: Genius
  12. navneethegde

    74,442

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  13. Masteraco

    70,367

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  14. binaryevo

    70,365

    Master

    0 points yesterday

    Profile
    Rank: Guru
  15. ambience

    69,104

    Master

    0 points yesterday

    Profile
    Rank: Sage
  16. emoreau

    68,230

    Master

    0 points yesterday

    Profile
    Rank: Genius
  17. PaulHews

    49,486

    0 points yesterday

    Profile
    Rank: Genius
  18. AndyAinscow

    45,290

    0 points yesterday

    Profile
    Rank: Genius
  19. Chinmay_Patel

    43,411

    0 points yesterday

    Profile
    Rank: Genius
  20. ged325

    41,700

    2,600 points yesterday

    Profile
    Rank: Genius
  21. RolandDeschain

    41,317

    0 points yesterday

    Profile
    Rank: Sage
  22. nishantcomp2512

    39,486

    0 points yesterday

    Profile
    Rank: Wizard
  23. tommyBoy

    36,550

    0 points yesterday

    Profile
    Rank: Genius
  24. mroonal

    35,000

    0 points yesterday

    Profile
    Rank: Sage
  25. santhimurthyd

    34,650

    0 points yesterday

    Profile
    Rank: Wizard

Hall Of Fame