Professional ASP.NET 3.5 in C# and Visual Basic Part 113

Professional in C# and Visual Basic Part 113. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 23 Caching The HttpCachePolicy class gives you an object model for managing client-side state that insulates you from adding HTTP headers yourself. Add the lines from Listing 23-3 to your Page_Load to influence the Response s headers and the caching behavior of the browser. This listing tells the browser not to cache this Response in memory nor store it on disk. It also directs the Response to expire immediately. Listing 23-3 Using HTTP Headers to force the browser not to cache on the client-side VB Protected Sub Page_Load ByVal sender As Object _ ByVal e As Handles End Sub C protected void Page_Load object sender EventArgs e Figure 23-3 1079 Chapter 23 Caching Compare the results of running Listing 23-3 in the before Figure 23-2 and then in the after Figure 23-3. Two new HTTP headers have been injected directing the client s browser and the Cache-Control Header has changed to no-cache no-store. The Output Caching HttpModule will respect these HTTP headers so sending no-cache no store to the browser also advises the HttpModule to record the response as a cache miss. If your application contains a considerable number of relatively static or non-time-sensitive pages consider what your client-side caching strategy is. It s better to take advantage of the disk space and the memory of your users powerful client machines rather than burdening your server s limited resources. Caching Programmatically Output Caching is a very declarative business. UserControls and Pages can be marked up with OutputCache directives and dramatically change the behavior of your site. Declarative caching controls the

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.