barcode library c# Disabling the Viewstate at the Page and Application Levels in Font

Generation Code 39 Extended in Font Disabling the Viewstate at the Page and Application Levels

Disabling the Viewstate at the Page and Application Levels
Code 3/9 Maker In None
Using Barcode printer for Font Control to generate, create Code 39 Full ASCII image in Font applications.
www.OnBarcode.com
Make UCC-128 In None
Using Barcode encoder for Font Control to generate, create EAN 128 image in Font applications.
www.OnBarcode.com
In light of the previous discussion, you might start looking at the Label controls used in the ViewUser.aspx page of Friends Reunion. None of these Label controls make use of its viewstate, so they can all be disabled. In fact, in ViewUser.aspx, you can go one step further. If you consider the controls in that page, you ll notice that none of them need to keep their state between postbacks! So, you could deal with them all in one go by disabling the viewstate for the whole page. To do that, you could just set the EnableViewState attribute to false within the Page directive: <%@ Page language="vb" Codebehind="ViewUser.aspx.vb" AutoEventWireup="false" Inherits="FriendsReunion.ViewUser" EnableViewState="false" %> If you re writing an application that doesn t use viewstate at all, you could disable the viewstate at the application level by making a simple change to the application s Web.config file. Simply find the <pages> element and set its EnableViewState attribute to false: <configuration> ... <system.web> <pages ... EnableViewState="false" />
USS Code 128 Creation In None
Using Barcode generation for Font Control to generate, create Code-128 image in Font applications.
www.OnBarcode.com
Generate Code 39 Extended In None
Using Barcode creator for Font Control to generate, create Code 39 image in Font applications.
www.OnBarcode.com
CHAPTER 12 CACHING AND PERFORMANCE TUNING
Make PDF-417 2d Barcode In None
Using Barcode creation for Font Control to generate, create PDF 417 image in Font applications.
www.OnBarcode.com
Generate QR Code In None
Using Barcode generation for Font Control to generate, create Quick Response Code image in Font applications.
www.OnBarcode.com
... </system.web> ... </configuration> Don t do this in the Friends Reunion application, because there are some parts of that application that do rely on the viewstate!
Creating GTIN - 12 In None
Using Barcode generator for Font Control to generate, create UPC Symbol image in Font applications.
www.OnBarcode.com
Creating Code 11 In None
Using Barcode maker for Font Control to generate, create Code11 image in Font applications.
www.OnBarcode.com
Checking the Viewstate Encryption Features
Painting Code 3/9 In None
Using Barcode creation for Office Word Control to generate, create Code 3/9 image in Word applications.
www.OnBarcode.com
Code 3 Of 9 Encoder In Objective-C
Using Barcode creator for iPad Control to generate, create Code 39 Full ASCII image in iPad applications.
www.OnBarcode.com
It is also important to check that the tamper-proofing and encryption features of the viewstate are not enabled in your application if you don t really need the extra security that these features provide. This level of security will certainly impact the performance of your application, so disable it if you don t need it. The tamper-proofing mechanism can be specified by setting the EnableViewStateMAC attribute in the Page directive: <%@Page ... other attributes ... EnableViewStateMAC="false" %> There is no need to explicitly disable encryption, because it depends on EnableViewStateMAC being set to true. Note that the value of the EnableViewStateMAC attribute doesn t affect your ability to use the viewstate for individual controls. In contrast, if the value of the EnableViewState attribute is false, then it disables the viewstate-related security settings.
QR Code ISO/IEC18004 Generator In .NET Framework
Using Barcode creation for ASP.NET Control to generate, create QR Code 2d barcode image in ASP.NET applications.
www.OnBarcode.com
Quick Response Code Maker In Java
Using Barcode creation for Android Control to generate, create QR Code image in Android applications.
www.OnBarcode.com
Deciding What to Put in Viewstate
Code-39 Recognizer In VB.NET
Using Barcode reader for .NET framework Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
UCC.EAN - 128 Generator In None
Using Barcode printer for Microsoft Excel Control to generate, create UCC - 12 image in Office Excel applications.
www.OnBarcode.com
Finally, we recommend that you are selective about what data types you store in the viewstate. Integers, Booleans, hash tables, strings, arrays, and array lists containing any of the former, as well as Pair and Triplet types, are okay, because the viewstate serializer is optimized to work with these types. Other data types should be avoided if possible, because saving other serializable types into the viewstate is a slower process.
DataMatrix Maker In None
Using Barcode printer for Excel Control to generate, create ECC200 image in Microsoft Excel applications.
www.OnBarcode.com
DataMatrix Generator In VS .NET
Using Barcode encoder for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in VS .NET applications.
www.OnBarcode.com
More ASP.NET Performance Tips
Generate Code39 In Java
Using Barcode maker for Eclipse BIRT Control to generate, create ANSI/AIM Code 39 image in Eclipse BIRT applications.
www.OnBarcode.com
GTIN - 128 Drawer In None
Using Barcode encoder for Software Control to generate, create GS1 128 image in Software applications.
www.OnBarcode.com
You have already learned plenty in this chapter about how to examine and improve the performance of specific pages, and you ve seen a couple of demonstrations in which carefully chosen caching techniques and controlling the viewstate enhance the overall performance of the page and the application. In the remainder of the chapter, we ll take a look at some other ASP .NET performance tips. Not all of them are immediately applicable to the Friends Reunion application, but you will surely find them useful when developing your own applications.
PDF 417 Reader In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Code 128C Creation In None
Using Barcode generation for Software Control to generate, create Code-128 image in Software applications.
www.OnBarcode.com
Server-Side Redirection Using Server.Transfer
When the user is redirected between pages of an application using Response.Redirect(), the server sends an HTTP 302 Redirect response to the client passing the target URL. The 302
CHAPTER 12 CACHING AND PERFORMANCE TUNING
Redirect response tells the browser to issue a new request with the new URL. Effectively, the redirection is handled by this extra round-trip between the client and server, to finally get the user to the desired page, as illustrated in Figure 12-14.
Figure 12-14. Redirection involves an extra round-trip. You can avoid this extra round-trip by employing Server.Transfer() instead of Response.Redirect(). Server.Transfer() transfers the execution to a different page within your application. It s a sort of server-side redirect, in which the client doesn t notice that a redirect occurs. Try It Out: Use Server.Transfer for Server-Side Redirection You can quickly apply this improvement to the Friends Reunion application. 1. Perform a search (Ctrl+Shift+F) on the files in the Friends Reunion application to find occurrences of the Response.Redirect() method call in the application. There are quite a few; for example, you ll find them in Logout.aspx.vb, NewUser.aspx.vb, and ViewUser.aspx.vb. 2. Go to each one in turn (or perform a global Find and Replace in Files) and replace the Response.Redirect() with a Server.Transfer() method call. The new method will take the same single parameter as the old one. For example, here s the change in the UpdateUser() method in NewUser.aspx.vb: If doredirect Then Server.Transfer("../Default.aspx")
How It Works Replacing the Response.Redirect() method call with a Server.Transfer() method call simply means that the redirection is managed on the server, without a round-trip to the client, as illustrated in Figure 12-15. The performance improvement from this change manifests itself in two ways: The server now needs to handle just one request, instead of two. There are only two messages sent (one request and one response) instead of four, and that reduces the delay perceived by the end users as they wait for a response to appear on the browser.
Copyright © OnBarcode.com . All rights reserved.