Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to migrate ASP.NET

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to migrate ASP.NET". In daily operation, I believe many people have doubts about how to migrate ASP.NET. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to migrate ASP.NET". Next, please follow the editor to study!

Web Standards / Web standard

To do Web applications, you must first know how to do Web, and now you are advocating Web Standards, which involves XHTML, CSS and JavaScript. Many ASP programmers may already be familiar with old-fashioned table typesetting, but this is something that should be discarded. A lot of articles promoting Web Standards give a lot of disadvantages of table typesetting. I won't say much about that. What I'm going to say is that not using Web Standards is one of the deadliest disadvantages for ASP.NET programmers. Because MS is also closer to Web Standards, ASP.NET 2.0 is designed to be Web Standards compatible, and all controls are designed to separate semantics from presentation. If you do not follow this separation rule to divide the work, then as you and your artists take turns weaving this Web, one day this Web will tie you and your artists to death.

To learn the design of XHTML+CSS well, you need not only a change in concept, but also a change in development tools. Many people can not adapt to the design concept of Web Standards because they are still using old tools, so they always feel that it is more convenient and effective to design with the old concept. Because I believe that only when you adapt to the new tools and experience the convenience and efficiency of the new tools will you be willing to accept the change of ideas.

Speaking of development tools, I assume that skilled ASP programmers can write XHTML and CSS in plain text completely out of WYSIWYG's editor, because XHTML+CSS development requires both you and your artists to have this ability. In the past, artists can comfortably face Photoshop, which is the tool they are most used to use, which is accurate and visual at the same time. They may think with their eyes half the time. However, now there is no such a good thing to switch to CSS, the software that can design CSS like Photoshop has not been born, modifying any CSS rule will be applied to all pages, as for which elements of each page will match this CSS rule, this requires artists to keep in mind with their heads, not visualization. Although it is also an option to change the CSS rules and take a look at the preview of several pages, this is much worse than the instant preview when adjusting the parameters in Photoshop, so it is important for artists to learn to preview in their heads in order to write a good CSS.

If I were to recommend some tools, I would choose Visual Studio 2005 + Expression Web Beta 1, the former used by developers and the latter used by artists to design or modify Web pages.

OOP / object-oriented programming

OOP can be said to be the foundation of ASP.NET. Without OOP, there would be no concept of ASP.NET controls, and there would be no biggest difference between ASP.NET and ASP.

Starting with the original CGI, Web application developers designed a logic to generate output Response based on the input Request, and in most cases both are flat plain text strings, unless the design uploads / downloads files. ASP introduced Request and Response objects to make the processing a little more stereoscopic, you no longer need to manually analyze Request text, it can help you to submit Form, QueryString, Cookies and other parameters extracted for your use. The introduction of Session and Application objects allows you to store for a specific purpose without knowing the details, while the introduction of Server objects provides you with a lot of useful functions.

The problem with ASP is that the data provided by the stereoscopic Request is flat, and the whole processing process is also flat. That is to say, at any step in the process, you can access any Request data item and output the result to Response, which results in a high degree of coupling of the program code. If there is a problem with the output Response, you cannot specify which part of the process is directly responsible for it.

ASP.NET tries to solve this problem by introducing the concept of controls. Each control is an independent logical unit, which is only responsible for its own internal logic and minimizes its dependence on the external environment. Control no longer has random access to Request and Response like normal ASP logic, and its capabilities should be limited:

A control should only read the data submitted by the HTML element it generates, otherwise you should consider getting it through the properties of other controls rather than from Request. The details are as follows:

◆ IPostBackDataHandler and IPostBackEventHandler are designed for controls to handle parameters and events related to the HTML they generate.

◆ if the data that the control wants to get is from the child control, it should be obtained through the properties of the child control.

◆ if the data that the control wants to get is from an external control, it should ask the parent control or environment to get it.

The HTML generated by a control should be environment-independent, that is, no matter what kind of HTML other controls generate, it will not conflict with the HTML generated by this control. The details are as follows:

◆ Render is used to generate the HTML of this control.

◆ if the HTML to be generated by the control has a condition that may cause conflicts, you should request parent control or environment processing. For example, in the most common generation script, to avoid multiple outputs of the same script, you should register the script with ClientScriptManager and let it feel the output of the script.

Of course, you can violate the above rules as much as you like, and no one requires you to do so. But only by following these rules can you be considered an ASP.NET programmer, otherwise you are just an ASP programmer using the ASP.NET framework.

To obey these rules, you must first learn OOP well, so that you can understand why and how to obey them. Because the rules are dead, and the situation we face may be flexible, how should we choose to design in the face of a new situation? Obviously you may not be able to find one of the above rules for reference, and then your OOP ideas and values play a decisive role.

HTTP protocol

There's really nothing to say about the HTTP protocol, something a skilled ASP programmer must know, and it probably hasn't changed since the day you learned ASP. It's just that for ASP programmers, this is transparent because we use Request directly, which is not much different from dealing with the HTTP protocol directly. But when ASP.NET,Request is hidden, you should avoid using it, and you need to pay attention to the HTTP protocol, otherwise you have no idea what happens to the underlying communication.

At this point, the study on "how to transfer ASP.NET" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 291

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report