Refactor Large methods.
Do not share Member variables.
Use Try Catch and Finally block.
Close objects once its work is over.
Open database connection just before executing query and close in finally block.
Create Business Objects.
Sepearte Presentation, Business Logic and Data Access layers.
Do not send database objects to presentation layer.
Use Generics.
Catch exceptions, give proper message to user and store info in log file.
Store ConnectionString in Web.Config file encrypted
Use Page.IsValid before submitting your page when you are using Server side validation controls
when any browser doesnt support javascript, Page.IsValid avoids submitting data
Use StringBuilder than String
Use Custom Base Page class when there is a need to change some value for all pages
Do not forget to change Debug property to False before Deploying application into production
Always use dataReaders with "using" like
Using (SQLdataReader dr = cmd.ExecuteReader())
{
While(dr.read())
{
Response.Write(dr.GetString(0));
}
}
Use dataReader when datspeed is a concern
Whenever data is retrieved from database to a variable check for null
Use ObjectDataSource than SQLdataSource
Use CSS instead of formatting controls in page itself
If page is CrossPosted check if PreviousPage != null
If you want to resue inside a single project Web User Control is the fastest way.
Do not store heavy objects in ViewState
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment