Reduce Page size in Asp.net

Last post 11-06-2009 3:30 AM by Sgro. 14 replies.

Sort Posts:

  • Reduce Page size in Asp.net

    11-03-2009, 3:00 AM
    • Member
      40 point Member
    • ashok.k
    • Member since 02-02-2009, 12:23 PM
    • Posts 119

    Hi,

    we are developing website using asp.net. we are using master pages, styles,scripts and images in our site. at runtime if we save the page it shows arround 1.4 MB.

    we need to reduce the page size as well need to improve the rendering time.. can any one suggest how to reduce page size..

    Regards, 
    Ashok

  • Re: Reduce Page size in Asp.net

    11-03-2009, 7:41 AM

    what is the size of the image on the web page?

    if image size is large , try converting the image to a lower size format

    eg bmp takes more space than jpg

  • Re: Reduce Page size in Asp.net

    11-03-2009, 7:57 AM
    • Participant
      878 point Participant
    • PavanOIrish
    • Member since 10-07-2009, 10:22 AM
    • Posts 149

    As the fellow memeber suggested optimize the images, could you also let us know. 

    What type controls you are using on page? 

    Is viewstate enabled for the entire site?

    Are you making any database connections?

     

  • Re: Reduce Page size in Asp.net

    11-03-2009, 8:17 AM
    • Member
      40 point Member
    • ashok.k
    • Member since 02-02-2009, 12:23 PM
    • Posts 119

    Hi

    Actually we tried to rename the image folder and launch the site without any images.. but it got reduced only 200 kb of page size. so image size is not taking much size... 

  • Re: Reduce Page size in Asp.net

    11-03-2009, 8:19 AM
    • Member
      40 point Member
    • ashok.k
    • Member since 02-02-2009, 12:23 PM
    • Posts 119

    Hi

    we are disabled viewstate in all the grid controls we are using in the page..  

     

    Regards

    Ashok

  • Re: Reduce Page size in Asp.net

    11-03-2009, 8:39 AM
    • Member
      434 point Member
    • urstop
    • Member since 12-04-2007, 3:24 AM
    • Posts 98

    1. Minify the Javascript files. If you are using lot of inline Javascript, move them to external JS files and minify it.

    2. Check if you are using lot of repetitive inline styles and move them to style sheets.

    3. Disable ViewState on controls which you think don't need viewstate.

    4. Check the type of images you are using. Use gif/png as they have less size.

  • Re: Reduce Page size in Asp.net

    11-03-2009, 8:48 AM
    • Participant
      914 point Participant
    • Babunareshnarra
    • Member since 07-12-2009, 7:10 AM
    • Hyderabad
    • Posts 183

    Best option is

    • In the page directive set EnableViewState to false.
    • Use sprites in CSS so as it needs low memory.
    • Use Skins instead of using css files.

    Hope this helps.


    Regards

    Babu Naresh Narra

    Remember to click “Mark as Answer” on the post If you get answer from my post(s) !
  • Re: Reduce Page size in Asp.net

    11-03-2009, 1:53 PM
    Answer
    • All-Star
      124,620 point All-Star
    • XIII
    • Member since 06-30-2002, 11:59 PM
    • Essen, Belgium
    • Posts 13,751
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    also be sure to take a look at this article: Best Practices for Speeding Up Your Web Site.

    What helped our project out the most was compression of the output on the server and also before that taking out most of the whitelines and spaces in the html parts to vastly reduce the size of the sent html.

    Grz, Kris. 

  • Re: Reduce Page size in Asp.net

    11-04-2009, 9:38 AM
    • Contributor
      6,114 point Contributor
    • atconway
    • Member since 09-24-2007, 9:20 PM
    • Florida U.S.A
    • Posts 1,259

    I have a few pieces of advice for you about stremlining the size or at least analyzing the size of your pages.  1st, if you have not already, download the 'Viewstate Helper' tool to analyze your pages:

    ASP.NET ViewState Helper: 

    http://www.binaryfortress.com/aspnet-viewstate-helper/

    Viewstate is one of the biggest culprit of robust page sizes if it is not used properly.  Here is a good article to review in regards to how to properly use ViewState:

    Understanding ASP.NET View State:

    http://msdn.microsoft.com/en-us/library/ms972976.aspx

    Here is another online tool to analyze your pages, but this one you must paste in a URL:

    Web Page Analyzer:

    http://www.websiteoptimization.com/services/analyze/

    Here is a good article to review as well with performance tips:

    10 Tips for Writing High-Performance Web Applications:

    http://msdn.microsoft.com/en-us/magazine/cc163854.aspx

    Other helpful links:

    Reduce Page size in Asp.net:

    http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/63e7cdbb-f8ca-4d66-8df9-d73f8f212a7d

    Chapter 6 — Improving ASP.NET Performance:

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

    http://forums.asp.net/t/1380212.aspx

    http://forums.asp.net/t/1232895.aspx

     

    Thank you,   >[Blog]<

    "The best thing about a boolean is even if you are wrong, you are only off by a bit." :D
    -anonymous

  • Re: Reduce Page size in Asp.net

    11-04-2009, 9:48 AM

    Have you also thought about compressing pages & images etc using GZip? 

    Using HTTP Compression for Faster Downloads (IIS 6.0)

    My Books:

    Professional Enterprise .NET
    Check out my book on learning all about enterprise programming, including TDD, Mocking, DDD, Dependecy Injection, Inversion of Control, Dependency Inversion, NHibernate, MVC & MVP. Check out the code on the projects codeplex site.

    NHibernate with ASP.net Problem-Design-Solution
    Learn all about NHibernate with ASP.net.
  • Re: Reduce Page size in Asp.net

    11-05-2009, 3:52 AM
    • Participant
      762 point Participant
    • Sgro
    • Member since 06-10-2006, 3:55 AM
    • Posts 342

    A little list of tips, in order of importance:


    1. Move to Asp.net MVC - drop the bloating webforms paradigm.
    2. Code proper (x)html using the correct tags for your need (i.e. don't use tables for layout, etc). You'll find yourself with much lighter and cleaner page structure
    3. Load all decorative images through css - only content images with img tags
    4. Don't use inline style - always put all styling rules in CSS files.
    5. Don't use inline JS - always put JS code in JS files.
    6. Minify your JS files
    7. Use GZIP compression on your web server

    In the sites I have created, I hardly get a page output greater than 200kb on a site with very rich graphical design.

    Matteo Mosca
    Web Developer
    IWA Member
  • Re: Reduce Page size in Asp.net

    11-05-2009, 10:46 AM
    Answer
    • Contributor
      6,114 point Contributor
    • atconway
    • Member since 09-24-2007, 9:20 PM
    • Florida U.S.A
    • Posts 1,259

     

    Sgro:
    Move to Asp.net MVC - drop the bloating webforms paradigm.

    One thing I would like to add a comment about this- while this statement is 100% correct and MVC is much more lightweight, I think people need to understand that to convert a project or redesign the project using MVC is not done by the flick of a switch.

    I see it offered as a solution to similar problems often nowadays, but realistically that can be a huge undertaking in both the knowledge needed and amount of work to move to MVC.

    So in the previous post the difference in suggestions say #1 and #3 are night and day in regards to the amount of work.  It is almost analgous to saying "Just change your ASP.NET app to Silverlight".

    Don't get me wrong, the MVC suggestion is spot on, but I see it referenced so quickly often, and maybe giving the incorrect impression on what that entails in order to actually have your project designed using MVC.

    Again, this was just to highlight the previous great suggestions offered by Sgro, and offer additional notes for future readers.

    Thank you,   >[Blog]<

    "The best thing about a boolean is even if you are wrong, you are only off by a bit." :D
    -anonymous

  • Re: Reduce Page size in Asp.net

    11-05-2009, 11:06 AM
    • Contributor
      6,774 point Contributor
    • alaa9jo
    • Member since 07-01-2009, 1:17 PM
    • Jordan
    • Posts 1,209

    Most of the suggestions that my friends here have provided are very good,there is nothing to add but there is an add-on to firefox that helped me so much,it's called YSlow.It follows the practices the XIII has already provided.

    Just install FireFox,then search for an add-on called YSlow and install it and that's it! open your page in firefox then let the add-on analyze your page and tell you exactly what are the things that slows down your page and gives you suggestions that helps you greatly.

    Also I want to add that the less you show data and using of controls,the page will become lighter,use paging in gridview or any similar control that shows a great amount of data.

    Best Regards,
    Ala'a Alnajjar
    ----------------------------------------------------
    Please remember to click “Mark as Answer” on the post(s) of the member(s) that help(s) you even if they were for the same person.
    Also remember to close the thread by selecting “Resolved”,you will find it in your first post.

    Convert C# to VB.net and visa versus
    My Webblog
  • Re: Reduce Page size in Asp.net

    11-05-2009, 11:21 AM
    Answer
    • All-Star
      124,620 point All-Star
    • XIII
    • Member since 06-30-2002, 11:59 PM
    • Essen, Belgium
    • Posts 13,751
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    alaa9jo:
    there is an add-on to firefox that helped me so much,it's called YSlow.
     

    Besides YSlow, something I also use frequently, I'm also using the Page speed plugin for firebug: http://code.google.com/intl/nl-BE/speed/page-speed/. This also gives you interesting information and when used in combination you can squeeze out the bottlenecks somewhat better.

    Grz, Kris.

  • Re: Reduce Page size in Asp.net

    11-06-2009, 3:30 AM
    Answer
    • Participant
      762 point Participant
    • Sgro
    • Member since 06-10-2006, 3:55 AM
    • Posts 342

    That's right, I pointed to MVC without explaining the whole thing behind it.

    But when I usually do, a flame begins on these forums, so I thought this time to just point the direction, and let the reader discover what needs to be learned in order to use MVC.

    To make it quick, you can see webforms as "web for dummies" where no real web knowledge is needed to get a web application up and running, because the framework does all the "web" stuff for you (and does it pretty bad in my opinion).

    MVC is meant for real web developers who have knowledge and skills in (x)html, css, unobtrousive javascript, semantics, SEO and so forth.

    I actually used webforms in my early developer days, only to find myself extremely limited by it when I started to learn web technologies. I was just about to give up my hopes and move to RoR when the first beta of ASP.NET MVC came out, and made me so happy :D

    Matteo Mosca
    Web Developer
    IWA Member
Page 1 of 1 (15 items)