[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Madison

1/24/2008 2:40:00 PM

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

7 Answers

stcheng

1/25/2008 4:21:00 AM

0

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/ms9...

#TRULY Understanding ViewState
http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Und...
-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/20...

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


Also some other articles about ASP.NET state management:

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

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


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....
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/de....

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


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
>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
>
>

Alvin Bruney [ASP.NET MVP]

1/27/2008 3:45:00 PM

0

Isn't this posted in aspnet newsgroups?

--

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" <Madison@discussions.microsoft.com> wrote in message
news:FFFCF0FD-498D-4EAC-9CE9-8BAAE9F4F184@microsoft.com...
> 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
>

Madison

1/28/2008 10:55:00 PM

0

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.

stcheng

1/29/2008 2:45:00 AM

0

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/librar...(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.
>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.
>
>

stcheng

1/31/2008 9:18:00 AM

0

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,
>
>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/librar...(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.
>>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.
>>
>>
>
>

DSK Chakravarthy

3/13/2008 11:06:00 AM

0

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

"Madison" <Madison@discussions.microsoft.com> wrote in message
news:B4F81C6A-EC5F-4376-A46C-2B9E617E834A@microsoft.com...
> 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.
>

Alvin Bruney [ASP.NET MVP]

3/14/2008 4:10:00 PM

0

Why would you recommend dynamic controls loading over static controls on a
page. What is your perceived advantage of this approach.

--
--
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


"DSK Chakravarthy" <dskcheck@msn.com> wrote in message
news:A3D2BFB7-1C40-4664-9883-0C081DB89342@microsoft.com...
> 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
>
> "Madison" <Madison@discussions.microsoft.com> wrote in message
> news:B4F81C6A-EC5F-4376-A46C-2B9E617E834A@microsoft.com...
>> 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.
>>
>