20 old habits left by ASP

Source: Internet
Author: User
In the process of technological renewal, there are still some people who die clinging to something that is already too angry. There are some people who enter the new world, but still can not get rid of the old habits. I didn't use the word "bad habits" because I was also very disgusted with the word.
New technology should have the practice of new technology, into the ASP.net world, it should be used to correct the past, new into the New World, the ASP's junk thrown away.
The following are the wrong things to do, please do not be mistaken for the recommended practice to promote:
1. Use server side include to introduce a common page composition to aspx.
Under the asp.net mechanism, you should use ASCX (Web user control) to implement it. Ascx provides more controllable interfaces. And more importantly, Ascx is a class. A real class. It can be fully controlled.
2. Do not use Web.config
Web.config provides a very rich configuration management interface. Is the core part of an application. But many people's web.config are often empty. Or have never been modified.
3. Use Response.Write to output messages to the front end
Asp. NET platform of response and ASP response is very different. Although it represents the same meaning, it is already very different in usage. The Response.Write content is output only to the front end of the page. The correct way to output messages to the front end is to use placeholder.
4. Manage user connection status using a series of sessions
This approach is misused in the ASP. In a asp.net environment, the right thing to do is to design a class. Save the data in a structured way. Encapsulates access to session or cookie.
5. Use Session to verify identity
It's almost a common problem. Asp. NET provides a set of APIs for user authentication. Type is forms validation or Windows authentication. This quick start has a very clear section to explain. Most people can still rely on assigning a value to the session to maintain the user authentication status.
6. Use the Response.Redirect redirect page
This can be used when necessary. But not abused. The misuse of redirects has proved to be a logical cause of serious confusion. This is the practice of using the page as the program unit. Using the front controller mode will bring the user's operational logic together]
7. Use too many ASPX pages
In ASP environment, the program unit is only *.asp page, ASP. NET is not like this, there are back-end class library, ascx and so on. You should focus your business logic on separate units instead of using an ASPX for an operation. More often, ASPX manages page logic as a container for ascx or custom control. While ASPX reuses ascx, ASPX is also reused as a unified page composition.
8. Copy code between multiple logical units and modify the corresponding logic
Reuse. Reuse. Reuse. The principle of dealing with such problems is that no process of the same or similar kind occurs. If you use the above method, the result will be catastrophic once there is a major logical change.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.