In the process of technological updates, there are still some people holding things that have expired. some people enter the new world, but they still cannot get rid of old habits. I didn't use the word "bad habits", because I am also very disgusted with this word.
New technologies should adopt new technologies to enter the ASP. NET world, so we should correct our past habits, enter the New World, and discard ASP.
The following lists all incorrect practices. do not promote them by mistake as recommended:
1. Use server side include to introduce a common page diagram to Aspx.
In ASP. under the net mechanism, use ascx (Web user control. ascx provides more controllable interfaces. more importantly, ascx is a class. A real class. it can be fully controlled.
2. Do not use web. config
Web. config provides a rich set of configuration management interfaces. It is the core part of an application. However, many people's web. config is usually empty. Or it has never been modified.
3. Use response. Write to output messages to the front-end
ASP. the response under the net platform is very different from the ASP response. although it indicates the same meaning, its usage is already quite different. response. write content will only be output to the front-end of the page. the correct method for outputting messages to the front-end is to use placeholder.
4. Use a series of sessions to manage user connection status
This method is abused in ASP. In the ASP. NET environment, the correct method should be to design a class to save data in a structured manner and encapsulate access to sessions or cookies.
5. Use session to verify the identity
This is almost a common problem. ASP.. NET provides a set of APIS for user authentication. the type is form verification or Windows verification. this Quick Start section is very clear. the vast majority of users can still maintain the user identity authentication status by assigning values to sessions.
6. Use the response. Redirect redirect page
This can be used when necessary. but cannot be abused. it turns out that misuse of redirection will cause serious logical confusion. this is the practice when the page is a program unit. use the front controller mode to centralize user operation logic
7. Use too many aspx pages
The program units in the ASP environment are only *. ASP page, Asp. net is not the case, there are back-end class libraries, ascx and so on. the business logic should be concentrated in different units, instead of using An ASPX for one operation. in more cases, aspx manages the logic in the page as the container of ascx or custom control. when aspx is used to reuse ascx, aspx is also used as a unified page chart.
8. Copy the code among multiple logical units and modify the corresponding Logic
Reuse. reuse. reuse. the principle to deal with such problems is that no identical or similar process occurs. if you use the above method, once a major logical change occurs, the results will be disastrous.
9. Afraid to use dataset.
Many people are frightened by dataset. think "yes" affects performance. not even the first attempt. they always think that their products must be important and should be "careful" in design ". they often use arraylist or a low-level class designed to save the set data. difficult data import.
10. pay too much attention to "performance.
I am very dissatisfied with the ASP. NET viewstate mechanism, or I am always eager to find someone else. Instead, I am tired of myself. It may be more civilized if I pay more attention to connecting the database several times while dealing with viewstate.
11. The root directory of the application is messy.
ASP. net is a development project. not a website. different resource categories should be placed. for example, organize all static resources (style sheets, scripts, images) together. you can even write a set of APIs to manage them. aspx should be put together. ascx should be put together .. *. what about CS? Put them in another project.
12. Never bother writing the database access process
You should hand over this work to dataaccess Application Block. You have to switch the connection yourself. Why.
13. What you write is the most reliable.
The fact is often the opposite. pay more attention to the use of products written by others, and you are not charged for money.
14. randomly named aspx file names
This is the most painful thing. the aspx file name must be easily identified. certain rules should also be followed. because behind each aspx has a class with the same name, it's hard to imagine. in addition, most people do not know how to manage the name space of their projects. it seems like a ledger.
15. never inherit or derive
Some classes with the same behavior should be derived from the public base class. In actual sense, our aspx should have a base class pagebase, because there are always some common features that need to be abstracted.
16. Zero Property
Their classes (corresponding to aspx) only have private method. They do not disclose any of their own secrets. It must be a legacy of Java.
17. Zero ascx
Needless to say, he hasn't learned ASP. NET yet.
18. use Dreamweaver to "Draw" aspx
This group of artists were even excited about how to better "integrate" Dreamweaver and Visual Studio.
19. Be familiar with only system. Web. UI. webcontrol and system. Data. sqlclient. There should be some class libraries worth familiarizing yourself.
20. Zero comments
These are all easy-to-understand notes generated by an IDE.
21. Zero event
I don't know anything about "event-driven". I only know the write process in page_load (). Or I double-click a button to write the xxx_clock () process. I don't know the event and delegate in their programs.