Вы находитесь на странице: 1из 3

23 03 2012 ASP .

Net Web Page Optimization Checklist - CodeProject


1/3 www.codeproject.com/Articles/13785/ASP-Net-Web-Page-Optimization-Checklist


Not quite what ou are looking for? You ma want to tr:
10 ASP.NET Performance and Scalability Secrets
ASP.NET Web Site Performance Improvement
8,593,581 !
Email Password Sign in Join Lost password?
H A Q A D L Z F H! The Lounge asp.net site optimiation
A B C S R A

Web Development ASP.NET General
4

Licence
First Posted 14 A 2006
Views 47,401
Bookmarked 48
ASP .N W P
O C
By P S K | 14 Apr 2006 | Unedited
contribution
C# VB ASP.NET SQL Windows .NET Visual-Studio HTML Architect DBA , +
This article gives a simple checklist that can be simply run on any ASP .Net Web Page to
optimize it.


Part of T HTML5 / CSS3 Z
S A
More like this
More by this author
3.56 (13 votes)
I
This article gives a simple checklist that can simply be run on any ASP .Net Web Page to
optimize it. This is in no way a complete list, however it should work for most of the web
pages. For a performance critical application you will surely need to go beyond this
checklist and will require a more detailed plan.
C
Here is the list of checks that you need to run, not necessarily in order:
D VS - Set "EnableViewState=false" for any control that does not
need the view state. As a general rule if your page does not use postback, then it is
usually safe to disable viewstate for the complete page itself.
U P.I P_L - Make sure that all code in page_load
is within "if( Page.Ispostback)" unless it specifically needs to be executed upon every
Page Load.
A W S - If you are using Web Services in you page
and they take long time to load, then preferably use Asynchronous calls to Web
Services where ever applicable and make sure to wait for end of the calls before the
page is fully loaded. But remember Asynchronous calls have their own overheads, so
do not overdo it unless needed.
U S B - For any long string operations, use
String Builder instead.
S E H - DO not throw exceptions unless needed, since
throwing an exception will give you a performance hit. Instead try managing them by
using code like "if not system.dbnull ." Even you if you have to handle an exception
then de-allocate any memory extensive object within "finally" block. Do not depend
on Garbage Collector to do the job for you.
Collapse | Copy Code
//
// Tr
// 'Create Db Connection and call a quer
// sqlConn = Ne SqlClient.SqlConnection(STR_CONN)
// Catch e As Eception
// 'Thro an Error that occurred
// Thro e
// Finall
// 'Free Database connection objects
// sqlConn = Nothing
//End Tr
//
L P B - Leave Page buffering On, unless specifically required so.
Places where you might require to turn it on in case of very large pages so that user
can view something while the complete page is loading.
U C - Cache Data whenever possible especially data which you are sure
News: Geeky Words You Can Use
With Geeky Friends
The Code Project Insider. Free
each morning.
R A
Search Engine Optimization in AJAX
site
Converting an ASP.NET site into a
SharePoint site
23 03 2012 ASP .Net Web Page Optimization Checklist - CodeProject
2/3 www.codeproject.com/Articles/13785/ASP-Net-Web-Page-Optimization-Checklist
won't change at all or will be reused multiple times in the application. Make sure to
have consistent cache keys to avoid any bugs. For simple pages which do not
change regularly you can also go for page Caching
Collapse | Copy Code
//
// <% @OutputCache Duration="60" VarBParam="none" %>
//
Learn more about "VaryByParam" and "VaryByControl" for best results.
U S - As a rule unless required do not insert JavaScript directly into any
page, instead save them as script file ".js" and embed them. The benefit being that
common code can be shared and also once a script file is loaded into browser cache,
it is directly picked up from browser cache instead of downloading again.
R U J - Run through all Javascript and make sure that all
unused script is removed.
R H HTML T - In you are using a Tabstrip control
and if the HTML size is too large and the page does frequent reloads, then turn
Autopostback of Tabstrip on, put each Pageview inside a panel and turn visibility of
all Panels except the current one to False. This will force the page to reload every
time a tab is changed however the reload time will reduce heavily. Use your own
jurisdiction to best use.
A C
D - If your page does not use session then disable
session specifically for that page.
Collapse | Copy Code
//
// <%@ Page EnableSessionState="false" %>
//
If the page only reads session but does not write anything in session, then make it
read only.
Collapse | Copy Code
//
// '<%@ Page EnableSessionState="ReadOnl" %>
//
U O S O (VB .N ) - Enabling Option Script restricts implicit type
conversions, which helps avoid those annoying type conversion and also is a
Performance helper by eliminating hidden type conversions. I agree it takes away
some of you freedom, but believe me the advantages outweigh the freedom.
U T - When downloading huge amounts of data use Threading to load
Data in background. Be aware, however, that threading does carry overhead and
must be used carefully. A thread with a short lifetime is inherently inefficient, and
context switching takes a significant amount of execution time. You should use the
minimum number of long-term threads, and switch between them as rarely as you
can.
U C F - A chunky call is a function call that performs several
tasks. you should try to design your application so that it doesn't rely on small,
frequent calls that carry so much overhead.
U J A - In case you are doing heavy use of Multi Dimensional Arrays,
use Jagged Array ("Arrays of Arrays") Instead
Use "&" instead of "+" - You should use the concatenation operator (&) instead of
the plus operator (+) to concatenate strings. They are equivalent only if both
operands are of type String. When this is not the case, the + operator becomes late
bound and must perform type checking and conversions.
U A - In performance critical application where there are frequent page loads,
resort to Ajax.
U SDR - The SqlDataReader class provides a means to read
forward-only data stream retrieved from a SQL Server database. If you only need
to read data then SqlDataReader class offers higher performance than the DataSet
class because SqlDataReader uses the Tabular Data Stream protocol to read data
directly from a database connection
C S S - In-process session state is the
fastest solution. If you store only small data in session state, go for in-process
provider. The out-of-process solutions is useful if you scale your application across
multiple processors or multiple computers.
U S P - Stored procedures are pre-compiled and hence are much
faster than a direct SQL statement call.
U W S - Web Services depending on data volume can have
monstrous memory requirements. Do not go for Web Services unless your Business
Models demands it.
P D S - When you needs to display large amount of Data to the
user, go for a stored procedure based Data Paging technique instead of relying on
the Data Grid/ Data List Paging functionality. Basically download only data for the
Performance Optimization of
ASP.NET Applications on Client-side
Combres 2.0 - A Library for
ASP.NET Website Optimization
Optimized ASP.NET DataGrid
Sorting
Integrating Spring.NET with
ASP.NET Web Site
ASP.NET Web Site Performance
Improvement
Search Engine Optimization (SEO)
Enhancement in ASP.NET 4.0
Generate CSS sprites and
thumbnail images on the fly in
ASP.NET sites
JIT Optimizations
Site Navigation in ASP.NET 2.0
Best Practice No 4:- Improve
bandwidth performance of ASP.NET
sites using IIS compression
Yet another pre-compile tool for
ASP.NET web sites
Search Engine Optimization (SEO)
and Friendly URLs using ASP.NET
Performance Tuning though Pipeline
Optimization in ASP.NET
Integrating a Blogger.com Blog into
an ASP.NET 2.0 Web Site
Optimized Enum.ToString()
WatinN to Automate Browser and
Test Sophisticated ASP.NET AJAX
Sites
SEO optimization: add meta tags to
ASP.NET page programmatically
Optimizing Serialization in .NET
XML optimization
23 03 2012 ASP .Net Web Page Optimization Checklist - CodeProject
3/3 www.codeproject.com/Articles/13785/ASP-Net-Web-Page-Optimization-Checklist
Article Top Sign Up to vote Poor Ecellent Vote
S Go
Permalink | A dvertise | Privacy | Mobile
Web03 | 2.5.120315.1 | Last Updated 14 A pr 2006
A rticle Copyright 2006 by Paladugu Sai Krishna
Everything else Copyright CodeProject, 1999-2012
Terms of Use
current page.
L
This article has no explicit license attached to it but may contain usage terms in the article
text or the download files themselves. If in doubt please contact the author via the
discussion board below.
A list of licenses authors might use can be found here
A A
P S K
Web Developer
United States
Member
Sai krishna is a
Microsoft Certified
Professional in
Developing and
Implementing Web
Applications with
Microsoft Visual C#
.NET and Microsoft
Visual Studio .NET
and is currently
working as a System
Analyst/Project
Lead. He has 6 years
of experience
working in the field
of web development.
C D

Y S I . (secure sign-in)


Profile popups Noise Medi um Layout Normal Per page 10
Update
Refresh First Prev Next
A K 7:59 30 M '11
C P 20:36 4 F '10
EDI-X 20:50 27 A '08
SHAHAJI NANGARE 0:12 11 J '08
Last Visit: 19:00 31 Dec '99 Last Update: 4:26 23 Mar '12 1
General News Suggestion Question Bug Answer Joke Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch
pages.
Layout: fixed
| fluid
M 3
M 2
S P
G A

Вам также может понравиться