Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / March 2008

Tip: Looking for answers? Try searching our database.

State Management

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Madison - 24 Jan 2008 14:40 GMT
Hello There,

I have web application that went to production about 2 weeks ago. The web
page captures a lot of information for validation and calculation. I’m using
ViewState to maintain the postback  which slow down the page load every time
users entered some data and need calculation. This application is collected a
lot of information and need validation to feed back user when they are
leaving the textbox. Some validations will check when the users hit save
button. I try to use different state managements to handle the postback and
validation. I noticed ViewState will slow the page load and postback.

1.    What is the best practice for using viewstate if I just want to capture
the data just one page (DataTable with more than 100 rows)?
2.    What is the best way to clear session from memory?
a.    Session.Remove(“xxxx”)
b.    Session(“xxxx”) = Nothing
3.    How do I expire the Cache if the data changed?  I’m using Cache to hold
some datatable which not change more often but sometime I need to change the
data and want it to show to users right the way.
4.    What is the disadvantage of using Cache?

Thank you for any advices
Steven Cheng[MSFT] - 25 Jan 2008 04:20 GMT
Hi Madison,

Regarding on the State management questions you mentioned, here are some of
my understanding and suggestion:

ViewState is a media for persist some data across the postback of a certain
page, however, since it is stored in a hidden html input field in page's
html content, you should avoid store large number of data into it.
Otherwise, your page's size(response & request size) will be huge which
will surely slow down the response experience. here are some good articles
help you better understand ASP.NET viewstate:

#Understanding ASP.NET View State
http://msdn2.microsoft.com/en-us/library/ms972976.aspx

#TRULY Understanding ViewState  
http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding
-Viewstate.aspx

Session, Cache are both common storage in ASP.NET for store some data at
server-side. Session is good at store per-user data, however, you should
also avoid storing too much data into it, as you need to manually take care
of clearing the data in sessionstate(unless session timeout).

Cache though is not per-user specfiic, has a great advantage, it support
invalidate/timeout policy. You can use CacheDependency to control how a
cached object will expire(invalidate), include:

** File based dependency
** normal time period based timeout dependency
** Sql DataBase dependency(new in 2.0)
** or implement your own cache dependency

#ASP.NET Caching Basics
http://www.eggheadcafe.com/articles/20060407.asp

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/caching/data.aspx

Also some other articles about ASP.NET state management:

#State Management in ASP.NET
http://www.csharphelp.com/archives/archive207.html

#ASP.NET Cache and Session State Storage
http://west-wind.com/weblog/posts/1214.aspx

Hope these help some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================
   

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

>From: =?Utf-8?B?TWFkaXNvbg==?= <Madison@discussions.microsoft.com>
>Subject: State Management
>Date: Thu, 24 Jan 2008 06:40:05 -0800

>Hello There,
>
>I have web application that went to production about 2 weeks ago. The web
>page captures a lot of information for validation and calculation. I’m
using
>ViewState to maintain the postback  which slow down the page load every time
>users entered some data and need calculation. This application is collected a
[quoted text clipped - 9 lines]
>b.    Session(“xxxxâ€? = Nothing
>3.    How do I expire the Cache if the data changed?  I’m using Cache to
hold
>some datatable which not change more often but sometime I need to change the
>data and want it to show to users right the way.
>4.    What is the disadvantage of using Cache?
>
>Thank you for any advices
Madison - 28 Jan 2008 22:55 GMT
Hi Steve,
Thank you for your reply.
I try to understand why my web pages are slow to load. I'm not sure that
ViewState cause them or not. Some pages I switch to use Cache which help to
speed up. I have one page with about 36 textbox with each have their
RegularExpressionValidator,  6 label, 6 dropdownlist (all data came from
database with one dropdown have  >3,350 rows). Most of my pages contain 20-35
texboxes. This website uses master page with framework 2.0
Please advise how do I handle with slow load page. Thanks.
Steven Cheng[MSFT] - 29 Jan 2008 02:45 GMT
Thanks for your reply Madison,

Well, to check the loading slow issue, there are two common cases:

1. The server-side page processing(such as the work you do in event
handler) takes lots of time that cause the page slow

2. Your page output is quite large that cause network transfer very
slow(expecially for low network bandwidth case)

If you use ViewState a lot or have lots of html form elements(include those
ASP.NET server control such as Textbox which will be output as html input
text element), they'll also add to your page's output content.  You can
check the size of your page through save your page in client browser.  

As for server-side processing time, I think you can turn on the "Trace" of
your page and view page's Trace output, there will list the execution time
of each event(such as Init, Load ....).  Thus, if any of your tasks are
done during those events, you can inspect how long they take via the trace.

#ASP.NET Trace
http://msdn2.microsoft.com/en-us/library/y13fw6we(VS.71).aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
   

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: =?Utf-8?B?TWFkaXNvbg==?= <Madison@discussions.microsoft.com>
>References:  <FFFCF0FD-498D-4EAC-9CE9-8BAAE9F4F184@microsoft.com>
<Qs6R6mwXIHA.8024@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: State Management
>Date: Mon, 28 Jan 2008 14:55:01 -0800

>Hi Steve,
>Thank you for your reply.
[quoted text clipped - 5 lines]
>texboxes. This website uses master page with framework 2.0
>Please advise how do I handle with slow load page. Thanks.
Steven Cheng[MSFT] - 31 Jan 2008 09:17 GMT
Hi Madison,

Does my last reply help you some? If there is still anything need help,
welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
   

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Date: Tue, 29 Jan 2008 02:45:27 GMT
>Subject: RE: State Management

>Thanks for your reply Madison,
>
[quoted text clipped - 48 lines]
>>texboxes. This website uses master page with framework 2.0
>>Please advise how do I handle with slow load page. Thanks.
DSK Chakravarthy - 13 Mar 2008 12:06 GMT
Madison,

Instead of static controls on the given page, i always recommend to have the
controls dynamically added at runtime.

Secondly, Which type of RegularExpressionValidator you are using? ASP.NET
RegEx or JavaScript RegEx. Again there is a hitch with in the RegEx
controls. Certain controls like Mandatory RegExVaildator will fire then and
there with the control, where are the custom expression validator will fire
when the page is submitted for processing..

Towards, Slowing down the page, are there any business objects that are
declared and instantiated globally on the page level, if so, remove the
initialisation process from the global and move to some logical block like
IsPostBack code.

HTH
Chakravarthy

> Hi Steve,
> Thank you for your reply.
[quoted text clipped - 7 lines]
> texboxes. This website uses master page with framework 2.0
> Please advise how do I handle with slow load page. Thanks.
Alvin Bruney [ASP.NET MVP] - 14 Mar 2008 17:10 GMT
Why would you recommend dynamic controls loading over static controls on a
page. What is your perceived advantage of this approach.

Signature

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99

> Madison,
>
[quoted text clipped - 26 lines]
>> texboxes. This website uses master page with framework 2.0
>> Please advise how do I handle with slow load page. Thanks.
Alvin Bruney [ASP.NET MVP] - 27 Jan 2008 15:45 GMT
Isn't this posted in aspnet newsgroups?

Signature

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------

> Hello There,
>
[quoted text clipped - 23 lines]
>
> Thank you for any advices

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.