mirroring 2nd phases of 2nd resource files 2nd 3rd 4th 5th validating non-Latin user input 2nd 3rd localizaton displaying localized information 2nd 3rd 4th Location attribute Outp
Trang 1[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [Q] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 2Like the book? Buy it!
Trang 3[SYMBOL] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
.ascx file extension 2nd [See also Web user controls ]
.aspx file extension 2nd [See also ASP.NET pages ]
Trang 4[ SYMBOL ] [A] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 5DataTable 2nd 3rd
DataView 2nd 3rd
finding/sorting data 2nd 3rd 4th 5th multiple tables and 2nd 3rd 4th
Trang 6running together with ASP 2nd
tracing
worker process 2nd 3rd
retrieving execution information 2nd 3rd 4th 5th ASP.NET performance counters
security boundaries
Trang 7shared assemblies 2nd 3rd 4th
adding to Global Assembly Cache (GAC) 2nd 3rd assigning strong names 2nd 3rd 4th
Trang 8[ SYMBOL ] [ A ] [B] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 9[ SYMBOL ] [ A ] [ B ] [C] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 12data caching 2nd 3rd
fragment caching 2nd
Trang 13output caching 2nd 3rd 4th 5th 6th
security 2nd
authentication 2nd 3rd 4th 5th 6th 7th 8th authorization 2nd 3rd 4th
Web custom controls
composite controls 2nd 3rd 4th 5th 6th creating from scratch 2nd 3rd 4th
derived controls 2nd
Web server controls 2nd 3rd 4th 5th 6th adding to container controls
Trang 15Culture attribute, Page directive
CultureInfo class 2nd 3rd
CurrentCulture/CurrentUICulture properties 2nd 3rd 4th invariant culture 2nd
Trang 16[ SYMBOL ] [ A ] [ B ] [ C ] [D] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 17DataTable class 2nd
DataType property
DataColumn class
Trang 18predefined 2nd
merge module projects, creating 2nd 3rd project templates 2nd
server architectures 2nd 3rd 4th
clusters 2nd
Web farms
Trang 19BaseValidator class
displaying data 2nd 3rd 4th 5th 6th DataList control 2nd 3rd
Repeater control 2nd 3rd 4th 5th DisplayMode property
Trang 21[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [E] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
debugging [See debugging Web applications ]
testing applications [See testing Web applications ]
Eval method
DataBinder class 2nd 3rd
Trang 22try statements 2nd
try-catch-finally statements 2nd 3rd 4th 5th unhandled exceptions
application-level events 2nd 3rd
custom error pages 2nd 3rd 4th 5th 6th page-level events 2nd
Trang 23filter expressions 2nd sort expressions 2nd [ Team LiB ]
Trang 24[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [F] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 26[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [G] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 27displaying localized information 2nd 3rd 4th localization process 2nd 3rd
mirroring 2nd
resource files 2nd 3rd 4th 5th
validating non-Latin user input 2nd 3rd [ Team LiB ]
Trang 28[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [H] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 29[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [I] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 32[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [J] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
JPEG images, displaying 2nd
[ Team LiB ]
Trang 33[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [K] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 34[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [L] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 35mirroring 2nd
phases of 2nd
resource files 2nd 3rd 4th 5th
validating non-Latin user input 2nd 3rd localizaton
displaying localized information 2nd 3rd 4th
Location attribute (OutputCache directive) Lock method
HttpApplicationState class
Log property
EventLog class
logs (event) 2nd 3rd 4th 5th 6th 7th 8th lookups
transforming data 2nd
[ Team LiB ]
Trang 36[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [M] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 38[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [N] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 39[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [O] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 40[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [P] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Page class [See also ASP.NET pages ] 2nd 3rd 4th 5th 6th
Trang 44[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [R] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 46round trips 2nd 3rd 4th 5th 6th [See also state management ] RowChanged event
Trang 47[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [S] [ T ] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 48Page class 2nd
session state 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th performance considerations
Trang 50server-side techniques 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th application state 2nd 3rd 4th 5th 6th
Trang 53[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [T] [ U ] [ V ] [ W ] [ X ] [ Z ]
Trang 54throwing exceptions
TimeOut property
HttpSessionState class
tlbimp.exe (Type Library Importer) 2nd 3rd 4th ToolTip property
CompareValidator class
RangeValidator class
[ Team LiB ]
Trang 55[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [U] [ V ] [ W ] [ X ] [ Z ]
Trang 57[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [V] [ W ] [ X ] [ Z ]
Trang 58[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [W] [ X ] [ Z ]
Trang 63[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [X] [ Z ]
Trang 64[ SYMBOL ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ H ] [ I ] [ J ] [ K ] [ L ] [ M ] [ N ] [ O ] [ P ] [ Q ] [ R ] [ S ] [ T ] [ U ] [ V ] [ W ] [ X ] [Z]
zero-impact installation
[ Team LiB ]
Trang 65You should plan for performance early in the development cycle
of an application It is inexpensive to remove any performanceglitches early in the development cycle As the application
moves beyond design, the cost of modifying code or
redistributing an application goes up
The following list includes some of the commonly acknowledgedbest practices for developing high-performing applications usingthe NET Framework:
Use caching to store content ASP.NET enables you to cache
entire pages, fragments of pages, or controls You can alsocache variable data by specifying the parameters on whichthe data depends Using caching makes it quicker for
ASP.NET to return data in response to repeated requests forthe same page On the downside, caching consumes
memory Caching is also not recommended when the
application needs to always retrieve the most recent data
Avoid session state Whether you store it in process, in a
State Server, or in a SQL Server database, session statetakes memory and requires processing time to store andretrieve values If a Web form doesn't depend on sessionstate, disable the session state with the <@%
PageEnableSessionState="false" %> directive If a Webform only retrieves data but does not update the sessionstate, make the session state read-only with the <@% PageEnableSessionState="ReadOnly" %> directive
Avoid view state View state lets you persist the contents of
a control across trips between the client and server Thiscomes at the cost of additional bytes traveling in each
Trang 66controls to false when you don't need the control's
contents to persist
Use low-cost authentication Passport authentication is
slower than forms-based authentication, which is slowerthan Windows authentication Not authenticating users atall is the fastest choice
Use ASP.NET tracing to know the performance of the Web page Tracing provides information on the Web form control
tree structure; the size of the view state for each control;different stages of the page processing; and the timing ineach of the stages, headers, form variables, sessions andcookies, server variables, and so on Furthermore, you caninclude debug messages Therefore, this great amount ofinformation can be very helpful in knowing the performance
avoided For example, if you place a Label Web control onthe page that only displays static text and is never used inthe server-side code, you should place static HTML text inplace of the Label Web server control
Trang 67(such as a structure) is copied to a reference type (such as
a class), the compiler needs to create an object on the heapand copy the value of the value type from the stack to thisnewly created object on the heap This process is called
boxing On the other hand, when you copy a reference type
to a value type, the value of the object from the heap iscopied to the value type in the stack This process is called
unboxing You should be aware of the overhead involved in
boxing and unboxing, and while designing the application,you should choose appropriate data types to minimize thisoverhead
Use the StringBuilder class for complex string
Use AddRange() with collections A large number of
collection classes provide the AddRange() method, whichyou can use to add an array of items to the collection Using
Trang 68should monitor the use of the unmanaged component tosee whether you can reduce the number of calls betweenthe managed and unmanaged code, possibly by doing morework in each call rather than by making frequent calls to dosmall tasks
Make fewer calls across processes Working with distributed
applications involves the additional overhead of negotiatingnetwork- and application-level protocols Network speed canalso be a bottleneck The best approach is to get more donewith fewer calls across the network
Compile the application by using the Release configuration
When you are ready to deploy an application, compile it inRelease mode rather than in the default Debug mode
Applications compiled using Debug mode might run slowlybecause of the presence of extra debugging code
namespace
Use stored procedures instead of SQL statements When
working with an RDBMS such as SQL Server, you should usestored procedures rather than a set of SQL statements
given as a text command because stored procedures arehighly optimized for server-side data access and their useusually improves data access performance significantly
Trang 69in improving performance for a database-intensive Web
application You can run SQL Server's Profiler and IndexTuning Wizard to avoid any bottlenecks caused by indexing
In addition, you can use the SQL Server Query Analyzer tooptimize a query's performance
Use DataReader instead of DataSet for forward-only
sequential access If you are reading a table sequentially,
you should use DataReader rather than DataSet
DataReader creates a read-only, forward-only stream ofdata that increases application performance and reducessystem overhead because only one row is in memory at atime
Use connection pooling for the SQL Server NET data
provider The slowest database operation is establishing a
connection with the database The SQL Server NET DataProvider provides connection pooling to improve
performance when connecting to a SQL Server database Inconnection pooling, old connection information is stored in aconnection pool so it can be reused for the next connection.Making fewer new connections with each request providessignificant performance gains However, if you have
dynamic connection strings (that is, you change parameters
of the connection strings), you will effectively disallow
connection pooling because connections are pooled only onthe exact connect string (even whitespaces need to match)
To maximize the reuse of connections in a connection pool,you must use the same connection string for all the
connections
Avoid using auto-generated commands The
SqlCommandBuilder and OleDbCommandBuilder classes
enable you to automatically generate commands used toreconcile changes made to a DataSet Although automatic
Trang 70convenient, it also requires extra trips to the server to getthe schema information Therefore, you should make
convenience and performance trade-offs depending on theapplication's requirements
Use short-lived transactions Distributed transactions might
have significant performance overhead As a rule of thumb,you should use transactions only when required and keepthe transactions as short-lived as possible
Trang 71ASP.NET provides several techniques for preserving state
information across page postbacks I'll broadly categorize thesetechniques as either client-side or server-side, depending onwhere the resources are consumed for state management
Client-side Techniques for State Management
Client-side techniques use the HTML code and capabilities of theWeb browser to store state-related information ASP.NET
Trang 72Query strings are used to maintain state by appending the stateinformation to a page's URL The state data is separated fromthe actual URL with a question mark (?) The data attached tothe URL is usually a set of key-value pairs, in which each key-value pair is separated by an ampersand (&) For example, look
at this URL that embeds two key-value pairs (name and city):
www.buddy.com/find.aspx?name=Bill+Gates&city=redmond
Because of their simplicity, query strings are widely used forpassing a small amount of information to Web pages However,query strings suffer the following limitations:
Most browsers restrict the length of the query string; thisreduces the amount of data you can embed in a URL
Query strings do not provide any support for structured
data types
The information stored in a query string is not secure
because it is directly visible to the user in the browser'saddress field
Reading information from query strings in an ASP.NET program
is easy using the QueryString property of the current
HttpRequest object The QueryString property returns a
NameValueCollection object representing the key-value pairsstored in the query string For example, the following
expressions retrieve the value of the name and city,
respectively, from the query string used in the previous URL:
Request.QueryString["name"]
Request.QueryString["city"]