ASP.NET Page Load Time


I have a ASP.NET web application that uses Microsoft Silverlight. The issue that I have is that it takes a long time to load the page up (5 to 10 mins). I run this in debug mode so I know this will be slower than running the appilcation without debbuging, however even that method is still very slow. I have written some code in C# to retrieve some data from a Access database.

In the "Page Load" method I put a break point at the last line & when executing the code it gets there extremely quick, it just seems to take ages to load for what reason I do not know.

If anyone has any ideas that would be great.

Who is Participating?
Bob LearnedCommented:
That goes in an .aspx page.  It might not work for Silverlight, and I don't have any experience with Silverlight.  There are different approaches in an ASP.NET web page, such as a Label, or outputting to a file.
Bob LearnedCommented:
When determining page loading problems, the first place that I would look is the pay load.  How big is the page request?  Is there a lot of view state (this is Base-64 encoded UTF-16 XML, and can be very large)?

Taking a Bite Out of ASP.NET ViewState
mcs26Author Commented:
Hi LearnedOne,

Thanks for the reply. This is my first ASP.Net web application so I do not know where or how to find the pay load?

The page loads a chart which is a third party control from dotNetCharting. It uses Microsoft Silverlight & basically the code I have written is just transfering currency prices from an access database to the chart.

Thanks again,

Bob LearnedCommented:

You can determine page state size programmatically:
using System.Web.UI;
using System.IO;


        protected override void SavePageStateToPersistenceMedium(object viewState)
            // To calculate view state size:


            LosFormatter format = new LosFormatter();

            StringWriter writer = new StringWriter();

            format.Serialize(writer, viewState);

            int viewStateLength = writer.ToString().Length;

        protected override void Render(HtmlTextWriter writer)
            // To Calculate page size :
            StringWriter customWriter = new StringWriter();

            HtmlTextWriter localWriter = new HtmlTextWriter(customWriter);


            int pageLength = customWriter.ToString().Length;


Open in new window

mcs26Author Commented:
Should this code be put in the pageload event? Also where will I see the output?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.