Question

Many times when I view source my page.aspx, I find lots of lines (HTML, styles, java script, view states, etc) maybe thousands of lines. On the other side when I view the source of more complicated pages of others' sites like (SOF), I find small numbers of lines typically XHTML

  • Does this mean my pages are less performance and not that valid?

  • What is the reason ? some bad practices i made when i build my pages or as a result of the bad rendering of web forms aspx?

  • Should I turn to asp.net-MVC instead?

Was it helpful?

Solution

Well, it depends...

smaller pages load faster. Full stop. For sure a large page will take longer to load so that is not good for you. Also your text to html ratio can influence your seo result.

looking at the different items:

Styles: they should be in separate css files. Gives you better caching and reuse. Has nothing to do with mvc or not. Use the cssfriendly controls for asp.net.

Javascript: same here, use a CDN for stuff like jquery, ajax.net etc. and put your own scripts in one, minimized separate .js file. Not in your page.

viewstate: yes, this can kill performance and it grows fast. Especially on gridviews. You do not always need it and it can be turned off. Use with care... There is a lot to gain here.

Naming of your repeaters, content placeholders etc come back lots of times so keep them small in terms of nr of characters. Will also give you some help.

If you follow this, what is left is your html and the necessary viewstate. if done well there is not always a need for MVC. The size difference will not be that big anymore. Mvc gives you more control and It has other advantages though but the size of your page it should not be your primary motivation. Asp.net 4.5 will add compression and minification so it will be even less important. But the bottom line is that with large volumes every byte counts...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top