Welcome to WebmasterWorld Guest from 54.196.208.6

Forum Moderators: ocean10000

Message Too Old, No Replies

.NET code bloat?

.NET ASP and huge code!

     
10:21 am on Mar 9, 2007 (gmt 0)

New User

5+ Year Member

joined:Jan 15, 2007
posts:14
votes: 0


Firstly, I am not a webmaster, I am simply a project manager with an inkling in the technical -- my dad eats code for breakfast and I've learned a few things...

However, because I manage a corporate event website, and that involves arguing the toss with our developers; I need to know a few things. The site is built on ASP.NET, and is content managed by us creating html pages with 'PageBuilder' WYSIWYG online (or, in my case, creating the page in DW and copy/paste-ing it into the online editor) which places our content in contentdiv tag.

However, when I viewed our page on my home connection, I noticed that it takes ages to load. Having looked at the source, I also just noticed that my content is very, very small! The code runs to 2347 lines of code and my content takes up a set of Divs near the top maybe 65 lines of code. Is this the same with all .NET sites? There are a few aspects of the site which are more like applications (an online user-customisable calendar and a few searches) but is it necessary for default.aspx to be so huge?

3:44 pm on Mar 9, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Mar 13, 2003
posts:335
votes: 0


I you have a hidden input called VIEWSTATE with a huge amount of data in it, it's cause by bad programming.
4:15 pm on Mar 9, 2007 (gmt 0)

New User

5+ Year Member

joined:Jan 15, 2007
posts:14
votes: 0


Viewstate code removed

[edited by: zbeauvais at 4:27 pm (utc) on Mar. 9, 2007]

4:21 pm on Mar 9, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Mar 13, 2003
posts:335
votes: 0


That's a pretty big VIEWSTATE It wasn't really necessary to post that to this forum. I'm sure the owners of the site would appreciate it if you removed it :)

Tell the programmers to make the VIEWSTATEs smaller.

4:31 pm on Mar 9, 2007 (gmt 0)

New User

5+ Year Member

joined:Jan 15, 2007
posts: 14
votes: 0


The viewstate was a single line of code on the source page which displayed 2300+ lines of code. Does the VIEWSTATE affect the rest of the code in the source, or is it just a line of code which could be slimmed down?
5:24 pm on Mar 9, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:852
votes: 0


At first glance at the problem is that the developers didn't turn off viewstate for the div which they inserted the event html code from the database. Thus in effect they had the event html code for the event twice (once in the displayed code, and the second was encoded in viewstate).

I am assuming that that even page is static in that it is used only for a simple sign up page and the event data does not change, and that the actual text of the event data does not need to be posted back and used. The use of the Cache Object offered in Asp.net, could be used to store the event html on the server if its needed again for later page refreshes, to save it from being put into viewstate. I am going to assume the developers could use this same methodology a lot on the site to reduce the page bloat.

6:22 pm on Mar 9, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Mar 13, 2003
posts:335
votes: 0


VIEWSTATE is only one cause of page bloat.

Obviously you also have a lot of other stuff going on if it's a simple page that doesn't seem to display much to the user.

If it's a landing page there's absolutely no reason why it needs to contain any hidden data, unless some sort of javascript app is buried in there, and if so, it ought to be moved to a separate .js file.

9:30 am on Mar 12, 2007 (gmt 0)

New User

5+ Year Member

joined:Jan 15, 2007
posts:14
votes: 0


Thanks, I'll need to investigate more thoroughly, I think.

Cheers,
-ZBeauvais