homepage Welcome to WebmasterWorld Guest from 54.226.191.80
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
.NET code bloat?
.NET ASP and huge code!
zbeauvais




msg:3276353
 10:21 am on Mar 9, 2007 (gmt 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?

 

Small Website Guy




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

I you have a hidden input called VIEWSTATE with a huge amount of data in it, it's cause by bad programming.

zbeauvais




msg:3276696
 4:15 pm on Mar 9, 2007 (gmt 0)

Viewstate code removed

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

Small Website Guy




msg:3276705
 4:21 pm on Mar 9, 2007 (gmt 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.

zbeauvais




msg:3276720
 4:31 pm on Mar 9, 2007 (gmt 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?

Ocean10000




msg:3276786
 5:24 pm on Mar 9, 2007 (gmt 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.

Small Website Guy




msg:3276834
 6:22 pm on Mar 9, 2007 (gmt 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.

zbeauvais




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

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

Cheers,
-ZBeauvais

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved