تقييمات الطلاب
( 5 من 5 )
١ تقييمات
فيديو شرح Caching multiple versions of user control using VaryByParam Part 125 ضمن كورس ASP.net شرح قناة kudvenkat، الفديو رقم 125 مجانى معتمد اونلاين
Text version of the video
http://csharp-video-tutorials.blogspot.com/2013/02/caching-multiple-versions-of-user_6.html
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1
Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-125-caching-multiple-versions-of.html
All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html
All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html
All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd
All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists
In Part 124 of the asp.net video tutorial, we discussed about caching multiple versions of user control using VaryByControl attribute of the "OutputCache" directive. Please watch Part 124 before proceeding with this video.
In this video we will discuss about, caching multiple versions of user control using VaryByParams attribute of the "OutputCache" directive.
We will be using the same user control "UCProductsControl.ascx" from Part 124, for this demo. If you need the code associated with the user control, please refer to Part 124, using the link below.
http://csharp-video-tutorials.blogspot.com/2013/02/caching-multiple-versions-of-user_6.html
When should we use VaryByParam over VaryByControl and vice versa?
OR
What is the difference between VaryByParam and VaryByControl?
If you want to cache multiple responses of a user control, based on a query string or a form "POST" parameter, then use VaryByParam. On the other hand, if you want to cache multiple responses of a user control, based on a control value then use "VaryByControl".
Caching multiple responses of a user control declaratively, using "VaryByParam" attribute of the "OutputCache" directive
To cache multiple responses of the user control, include "OutputCache" directive in the aspx of the UCProductsControl.ascx. Set VaryByParam"ProductName", which indicates that a separate response must be cached for each varying value of "ProductName" query string.
Caching multiple responses of a user control programatically, using "VaryByParams" property of the PartialCachingAttribute
We can also achieve the same thing, by specifying "PartialCachingAttribute" on the UCProductsControl class as shown below.
[PartialCaching(60, VaryByParams "ProductName")]
public partial class UCProductsControl : System.Web.UI.UserControl
{
//.Rest of the UCProductsControl code
}
Please run the application and test. Notice that, as the "ProductName" query string value changes, for each different value, a response from the user control is cached for 60 seconds. The difference between "User Control Server Time" and "User Control Client Time" proves this. Since, we don't have "Caching" set on the WebForm1.aspx, "Page Server Time" and "Page Client Time" stays the same always.