Today, I wandered in the forum and saw a buddy asked ASP. What questions should be paid to NET programming, and there is a buddy answer, write 21 big points of the ocean sprinkle. Personally think that these rules should be determined according to the actual situation of the project, to promote identification of materialism. . Take a closer look, I also found that I did so in the project development process, these problems were also left in the ASP process, and I would like to make my own habit.
1. Using Server Side Include to introduce a common page composition. Under the ASP.NET mechanism, ASCX (Web User Control) should be used. ASCX provides more controllable interfaces. And more importantly, ASCX is A class. A real class. You can fully control it.
2. Do not use Web.config Web.config to provide a very rich configuration management interface. It is the core part of an application. But many people's web.config is often empty. Or never modified. Web.config Mainly to keep the configuration of the server and the global information, this greatly reflected in the code of the Telligent Systems's ForuMs: 1. Introduce Name Space Information 2. Global information such as data access, file upload directory, resource file directory
3. With Response.Write's response and ASP's response under the ASP.NET platform, it is very different. Although it is the same meaning, it has been largely different. The content of Response.Write will only output to the page. The front end. The correct way to output the message forward is to use PlaceHolder. ~~~~~~~~~~~ This is not a skill, and people who are familiar with html should know this.
4. Using a series of session managed users Connection status This method is abused in ASP. In the ASP.NET environment, the correct approach should be designed. Structured saves data. Send the session or cookie access package ~~~~~~~~~~~~~~ Meaning should say that this object is saved, this is really so
5. Use the session to verify the identity. This is almost a common problem. ASP.NET provides a set of APIs for user authentication. Types are Forms verification or Windows verification. This quick start has a section that is clear. You can most People still rely on the SESSION assignment to maintain the user authentication status. ~~~~~~~~~~~~~~ Many people are indeed useful, they also have such a problem, should be changed
6. Redirect the page using the response.redirect to be used when necessary. But not abuse. It is fact that abuse redirect will result in logical serious confusion. This is the practice of the page as the program unit. Using Front The Controller mode will make the user's operational logic set up] ~~~~~~~~~~~~~ Response.Redirect is just the page jump.
7. Using too many ASPX Page ASP environments only * .asp page, ASP.NET is not like this, there is also a backend library, ASCX, and more. The business logic should be concentrated in different units, not You should use an action using an ASPX. More time ASPX will be used as an ASCX or CUSTOM Control container to manage page logic. AspX reuses ASCX, ASPX is also a unified page archive reuse.
8. Copy the code between multiple logic units and modify the corresponding logic reuse. Reuse. Reuse. The principle of processing such issues does not have any same or similar processes. If you use the above method, once a major logic change, The result will be a catastrophic. ~~~~~~~~~~~~~~~~~~~ increase the code reuse, you should "copy" code
9. I am afraid to use Dataset. Many people are frightened by Dataset. Think "affirmation" affects performance. But even the initial attempts do not dare. They always think that their products are significant, "cautious" should be designed. They often use arraylist Or design the low class to save the collection data. Careful data is poured into the job. ~~~~~~~~~~~~~~~~~~~~~~ It is also your own advantage. If there is no contact after the data collection, then you can use DataTable. 10. Too much attention to "Performance". It is particularly dissatisfied with the mechanism for ASP.NET ViewState. Or always dig your heart. It is more tired to put yourself. If you pay more attention to the viewstate, you will be more Civilization. ~~~~~~~~~~~~~~~ If the system is less than the system, performance considers are not main, because the general server can wait more than the number of people, if performance may become system Bottleneck, it should be greatly optimized, less server control
11. Application root directory is very chaotic. ASP.NET is a development project. Not a website. Different resource classifications should be placed. For example, all static resources (style sheets, scripts, images) are organized together. Even write a set of APIs To manage them. Aspx should be put together. ASCX should be put together. *. CS? Should you put them in another project. ~~~~~~~~~~~~~ This consent, at least The access layer is to be a separate class library.
12. The process of not annoying writing access databases should hand over this work to the DataAccess Application Block. You have to switch the connection, why.
13. The things you wrote are most close. The fact is often just the opposite. Pay more attention to the use of people to write products. Don't receive your money, why do you like to love the face?
14. This is the most painful name. This is the most painful. The ASPX file name is not only easy to identify. It should also follow a certain rule. Because Behind has a class of the same name, imagine, how difficult it is. Some people don't know the name space of managing their own projects. People seem to see a book.
15. Never inherit or derive some kinds of classes with the same behavior should be derived from the public base class. In fact, our ASPX should have a base class PageBase. Because there are some public features need to be abstract.
16. Zero Property only private method in their class (corresponding) in ASPX. Do not open any of your secrets. It can be this legacy of Java.
17. Zero ASCX does not have to say, he has not learned asp.net
18. This batch of people using Dreamweaver "ASPX is a beauty. There are even some people discuss how to better" integrate "Dreamweaver and Visual Studio are very intoxicated.
19. Just familiar with System.Web.ui.WebControl and System.Data.sqlclient should have some class libraries worthy of familiarity.
20. Zero Note These are all very clear in their hearts. The default comment generated by an IDE is there regardless.
21. Zero event does not know about "event driver". I only know in page_load (). Or double click a button to write the xxx_clock () process. You can't see Event and Delegate in their programs.