Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cache for asp.net user control

Reply
Thread Tools

Cache for asp.net user control

 
 
Billy Zhang
Guest
Posts: n/a
 
      06-13-2008
Here is a user control on the page, how do I cache it by user?
Currently I think we could put a server control for example ID:textusername
in the asp.net page whose value is username, so we can utilize Output cache
with varybycontrol to control the cache.

Queation:
If this is right direction, does this control ID:textusername need to be in
the user control or just in the asp.net page?

How do I check if it has been cached successfully?

If there are 2000 users, how do I check the memory the cache used?

Thanks,
-Billy
 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      06-13-2008
Hello Billy,

emm, not quite understand what do u want to get.
Cache the user name or the value of the control?!
To have the user-specific cache your can use the Session, or put the value
to the Cache class with the user name key and hashed by username (to make
it a bit secure in case of accessing this value from other user)

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


BZ> Here is a user control on the page, how do I cache it by user?
BZ> Currently I think we could put a server control for example
BZ> ID:textusername in the asp.net page whose value is username, so we
BZ> can utilize Output cache with varybycontrol to control the cache.
BZ>
BZ> Queation:
BZ> If this is right direction, does this control ID:textusername need
BZ> to be in
BZ> the user control or just in the asp.net page?
BZ> How do I check if it has been cached successfully?
BZ>
BZ> If there are 2000 users, how do I check the memory the cache used?
BZ>
BZ> Thanks,
BZ> -Billy


 
Reply With Quote
 
 
 
 
Billy Zhang
Guest
Posts: n/a
 
      06-13-2008
I want to cache a usercontrol by using Output cache.
There are two ways: VaryByControl and VaryByCustom.

Since I want to cache this usercontrol by different user, could i use
VaryByControl to control this?

If there are 2000 users, how do I check the memory the cache used?

"Michael Nemtsev [MVP]" wrote:

> Hello Billy,
>
> emm, not quite understand what do u want to get.
> Cache the user name or the value of the control?!
> To have the user-specific cache your can use the Session, or put the value
> to the Cache class with the user name key and hashed by username (to make
> it a bit secure in case of accessing this value from other user)
>
> ---
> WBR,
> Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour
>
> "The greatest danger for most of us is not that our aim is too high and we
> miss it, but that it is too low and we reach it" (c) Michelangelo
>
>
> BZ> Here is a user control on the page, how do I cache it by user?
> BZ> Currently I think we could put a server control for example
> BZ> ID:textusername in the asp.net page whose value is username, so we
> BZ> can utilize Output cache with varybycontrol to control the cache.
> BZ>
> BZ> Queation:
> BZ> If this is right direction, does this control ID:textusername need
> BZ> to be in
> BZ> the user control or just in the asp.net page?
> BZ> How do I check if it has been cached successfully?
> BZ>
> BZ> If there are 2000 users, how do I check the memory the cache used?
> BZ>
> BZ> Thanks,
> BZ> -Billy
>
>
>

 
Reply With Quote
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      06-13-2008
Hello

To cache a user control / a page by user name, as you said, we can either
use VaryByControl (a trick) or VaryByCustom, but I believe VaryByCusom is a
more direct way to accomplish the task. There is a blog article may exactly
meets the need:
http://aspadvice.com/blogs/ssmith/ar...g-By-User.aspx
Please try it in your user control, and for any other questions, let me
know!

In order to monitor the cache usage in asp.net, Steve Smith has written a
cool application that helps you monitor and manage your cache values in
ASP.NET. Read all about it here:
http://aspadvice.com/blogs/ssmith/ar...ost_Ready.aspx
There are other open source projects for the same purpose:
http://aspalliance.com/CacheManager/Default.aspx
http://www.codeproject.com/KB/web-ca...tinaspnet.aspx

Regards,
Jialiang Ge ((E-Mail Removed), remove ¡®online.¡¯)
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...#notifications.

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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


"Billy Zhang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I want to cache a usercontrol by using Output cache.
> There are two ways: VaryByControl and VaryByCustom.
>
> Since I want to cache this usercontrol by different user, could i use
> VaryByControl to control this?
>
> If there are 2000 users, how do I check the memory the cache used?
>
> "Michael Nemtsev [MVP]" wrote:
>
>> Hello Billy,
>>
>> emm, not quite understand what do u want to get.
>> Cache the user name or the value of the control?!
>> To have the user-specific cache your can use the Session, or put the
>> value
>> to the Cache class with the user name key and hashed by username (to make
>> it a bit secure in case of accessing this value from other user)
>>
>> ---
>> WBR,
>> Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour
>>
>> "The greatest danger for most of us is not that our aim is too high and
>> we
>> miss it, but that it is too low and we reach it" (c) Michelangelo
>>
>>
>> BZ> Here is a user control on the page, how do I cache it by user?
>> BZ> Currently I think we could put a server control for example
>> BZ> ID:textusername in the asp.net page whose value is username, so we
>> BZ> can utilize Output cache with varybycontrol to control the cache.
>> BZ>
>> BZ> Queation:
>> BZ> If this is right direction, does this control ID:textusername need
>> BZ> to be in
>> BZ> the user control or just in the asp.net page?
>> BZ> How do I check if it has been cached successfully?
>> BZ>
>> BZ> If there are 2000 users, how do I check the memory the cache used?
>> BZ>
>> BZ> Thanks,
>> BZ> -Billy
>>
>>
>>



 
Reply With Quote
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      06-18-2008
Hello Billy,

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Page.Cache vs HttpContext.Current.Cache DesignerX ASP .Net 5 01-20-2004 10:55 PM
View source while using Cache-Control: no-cache in frames Yaron Cohen Javascript 0 11-19-2003 10:06 AM
Cache::Cache Stale Segments Jeff Nokes Perl 0 09-30-2003 04:34 PM



Advertisments