20 major diploma left by ASP (reproduced)

xiaoxiao2021-03-06  54

In the process of technology updates, there are still things that have been in the abundance. There are also some people enter the new world, but they still can't get out of the old habits. I didn't use the word "bad habits". Because I am also very disgusted on this word.

New technologies should have new technologies. In the world of ASP.NET, they should correct past habits, new into new worlds, and throw away ASP.

The following is the wrong practice, please don't misunderstand the recommendation of the recommendation:

1. Use Server Side Include to introduce a common page composition to ASPX.

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. Can fully control it .

2. Do not use Web.config

Web.config provides a very rich configuration management interface. It is the most core part of an app. But many people's web.config is often empty. Or never modified.

3. Use the response.write to output a message forward

The response and ASP's response under the ASP.NET platform is very different. Although the same meaning is expressed, it has been largely different. The content of Response.Write will only output the front end of the page. The correct output message is output. The method is to use PlaceHolder.

4. Use a series of session to manage user connection status

This approach is abused in the ASP. In the ASP.NET environment, the correct approach should be designed. Structured storage data. Access to session or cookies will be encapsulated.

5. Use session to verify 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 very clear. Can most people still rely on the session assignment To keep the user authentication status.

6. Redirect the page with Response.Redirect

This can be used when necessary. But it is not abused. It is fact that abuse redirect will lead to logical serious confusion. This is the way to use the Front Controller mode. Using the Front Controller mode will enable the user's operational logic stand up]

7. Use too many ASPX pages

The program unit in the ASP environment is only * .asp page, ASP.NET is not like this, there is a rear end class library, ASCX, and more. The business logic should be concentrated in different units, not one action to use an ASPX. . More time ASPX will be used as an ASCX or Custom Control's container to manage page logic. At the same time as ASPX reusing ASCX, ASPX is also a unified page archive reuse.

8. Copy the code between multiple logical units and modify the corresponding logic

Reuse. Reuse. Reuse. The principle of dealing with such issues does not have any same or similar processes. If you use the above method, once a major logic change occurs, the result will be disastrous.

9. I am afraid to use DataSet.

Many people were frightened by Dataset. Think "affirmative" affects performance. But even the initial attempts don't dare. They always think that their products are certain, "cautious" should be designed. They often use arraylist or design low-level classes. Save collection data. Careful data pour it into work.

10. Too much attention to "Performance".

The mechanism for ASP.NET ViewState is particularly dissatisfied. Or always dig your mind persecuted people. Inverted yourself very tired. If you pay more attention to viewstate, you will pay more attention to a few databases.

11. The application root directory is very chaotic.

ASP.NET is a development project. Not site. Different resource classifications should be placed. For example, all static resources (style sheets, scripts, images) are organized together. You can even write a set of APIs to manage them. ASPX should be put together ASCX should be put together. *. CS? Should put them in another project.

12. Process for writing access to the database not annoying

This should be handed over to the DataAccess Application Block. You still have to switch Connection, why bother.

13. The things you write are most close.

The fact is often just the opposite. Pay more attention to the use of people to write products. Don't charge you money, why do you like to love the face?

14. Name the ASPX file 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 will have a class of the same name, imagine, more difficult. In addition, most people don't know how to manage themselves. The project's Name Space. It seems that it seems to see a book. 15. Never make inheritance or derived

Some classes with the same behavior should be derived from the public base class. In the actual sense, our ASPX should have a base class PageBase. Because there are always some public features need to be abstract.

16. Zero Property

There is only private method in their class (corresponding to AspX). No secrets of your own. It can be this legacy of Java's legacy.

17. Zero ASCX

Needless to say, he still didn't learn asp.net

18. Use Dreamweaver "painting" ASPX

This group of people is a beauty. There are even some people discuss how to better "integrate" Dreamweaver and Visual Studio discussing very intoxicated.

19. Just familiar with System.Web.ui.WebControl and System.Data.sqlclient

There should be some class libraries worth familiar with.

20. Zero Note

These are all very clear, and the default comment generated by an IDE is there.

21. Zero event

I don't know anything about "Event Driver". I only know in page_load (). Or double click a button to write xxx_clock () procedure. Event and delegate are not seen in their programs.

What else is to be written? If you encounter something that makes you deep, you can add it.

I have always thought that work is the most direct reflection of character. For programmers, the code is the most authentic heart portray.

Just personal opinion

转载请注明原文地址:https://www.9cbs.com/read-115227.html

New Post(0)