Documente Academic
Documente Profesional
Documente Cultură
1. Do not refresh the left filters (Location, Title, and Company etc), sponsors jobs and
sponsors ads while navigating through paging.
2. use of AJAX, update panel on search page, parital submitting the page
3. Check “Page.IsPostBack”. To avoid repetition code execution, all the code which is to be
executed only once on page put into ispostback.
Make sure you don't execute code needlessly. Use Page.ISPostBack property to ensure
that you only perform page initialization logic when a page is first time loaded and not in
response to client postbacks
Tradeoffs:
? ".transfer" process can work on only those sites running on the server. Only
Response.Redirect can do that.
? Server.Transfer maintains the original URL in the browser. This can really help
streamline data entry techniques, although it may make for confusion when debugging
5. A) To reduce CLR Exceptions count, Use Response.Redirect (".aspx", false) instead of
response.redirect (".aspx").
Always make sure you check Page.IsValid before processing your forms when using
Validator Controls.
8. Turn off Tracing unless until required. (by default it's off, use on the pages where it's
required)
Tracing is one of the wonderful features which enable us to track the application's trace and the
sequences. However, again it is useful only for developers and you can set this to "false" unless
you require to monitor the trace logging.
How it affects performance:
Enabling tracing adds performance overhead and might expose private information, so it should
be enabled only while an application is being actively analyzed.
Solution:
When not needed, tracing can be turned off using
<trace enabled="false" requestLimit=”10” pageoutput=”false” traceMode=”SortByTime”
localOnly=”true”>
One extremely powerful feature of ASP.NET is its ability to store session state for users, such as
a shopping cart on an e-commerce site or a browser history.
How it affects performance:
Since ASP.NET Manages session state by default, you pay the cost in memory even if you don't
use it. I.e. whether you store your data in in-process or on state server or in a Sql Database,
session state requires memory and it's also time consuming when you store or retrieve data from
it.
Solution:
You may not require session state when your pages are static or when you do not need to store
information captured in the page.
In such cases where you need not use session state, disable it on your web form using the
directive,
<@%Page EnableSessionState="false"%>
In case you use the session state only to retrieve data from it and not to update it, make the
session state read only by using the directive,
<@%Page EnableSessionState ="ReadOnly"%>
EnableViewState="false"
View state is a fancy name for ASP.NET storing some state data in a hidden input field inside the
generated page. When the page is posted back to the server, the server can parse, validate, and
apply this view state data back to the page's tree of controls.
View state is a very powerful capability since it allows state to be persisted with the client and it
requires no cookies or server memory to save this state. Many ASP.NET server controls use view
state to persist settings made during interactions with elements on the page, for example, saving
the current page that is being displayed when paging through data.
How it affects performance:
? There are a number of drawbacks to the use of view state, however.
? It increases the total payload of the page both when served and when requested. There is also
an additional overhead incurred when serializing or deserializing view state data that is posted
back to the server.
? View state increases the memory allocations on the server. Several server controls, the most
well known of which is the DataGrid, tend to make excessive use of view state, even in cases
where it is not needed.
Solution:
Pages that do not have any server postback events can have the view state turned off.
The default behavior of the ViewState property is enabled, but if you don't need it, you can turn it
off at the control or page level. Within a control, simply set the EnableViewState property to false,
or set it globally within the page using this setting:
<%@ Page EnableViewState="false" %>
If you turn view state off for a page or control, make sure you thoroughly test your pages to verify
that they continue to function correctly.
Then use:
dv = ds.Tables["Employees"].DefaultView;
Else
lb1.DataSource = dv;
lb1.DataTextField = "Name";
lb1.DataValueField = "Age";
DataBind () ;}
</script>
18. Make your page files as light as possible. That is try to avoid unnecessary markups, e.g. use
div elements instead of tables.
19. Write static messages in div and make it visible when necessary. This is faster than letting
server set Text property of your label or div.
20. Retrieve data from database at once, if possible. Don't add up to database trip as far as
possible. For this, combine the datafields from different tables and select them.
21. Use the String builder to concatenate string
How it affects performance:
String is Evil when you want to append and concatenate text to your string. All the activities you
do to the string are stored in the memory as separate references and it must be avoided as much
as possible.
i.e. When a string is modified, the run time will create a new string and return it, leaving the
original to be garbage collected. Most of the time this is a fast and simple way to do it, but when a
string is being modified repeatedly it begins to be a burden on performance: all of those
allocations eventually get expensive.
Solution:
Use String Builder when ever string concatenation is needed so that it only stores the value in the
original string and no additional reference is created.
DATABASE Improvements:-