In. NET platform development, we often use WinForm for C/S architecture development and ASP. NET for B/S architecture development. Some may be confused and do not know how to choose between them. In fact, as a developer who will develop on the. NET platform in the future, WinForm programming and ASP. NET programming should be mastered at the same time in any case.
BKJIA recommended reading: ASP. NET video tutorial
When developing applications with user interfaces, you can use WinForm or ASP. NET. Both have full design support in the development environment Visual Studio series, and can provide rich user interfaces and advanced application functions to solve real-world business problems. Because of this "similarity", it may be difficult to decide which technology to adopt to implement the software.
Focusing on the final use of software can make selection easier. If we want to develop an e-commerce website that the public can access over the Internet, ASP. NET will certainly be used to develop software projects. If we want to make full use of the computing power of the client computer, and the client's processing workload is heavy, We need to quickly respond to user requests, we should undoubtedly use WinForm. However, in other cases, the choice is not very clear.
When to select WinForm
If the client application is responsible for most of the processing tasks in the application, use WinForm to develop the application. These client applications include Win32 desktop applications traditionally developed in earlier versions of VB and VC. Graphics or graphics applications, data input systems, POS systems, and games all belong to these applications.
These applications rely on the processing capabilities of the desktop computer and high-performance data display. Some applications may be completely independent, and they execute all application processing on the user's computer. This method is usually used to compile a game. Other applications may be part of large systems that primarily use desktop computers to process user input. For example, a POS system usually requires that a complex user interface with responsiveness be created on a desktop computer, and the interface be linked to other components that execute backend processing.
The WinForm application is generated in the Windows framework. Therefore, it can access system resources on the client computer, including local files, system registries, and printers. This access level can be restricted to eliminate any security risks or potential problems caused by unwanted access. In addition, WinForm can use the. NET Framework GDI + graphics class to create a variety of interfaces, which are often necessary for data mining or game applications.
When to select ASP. NET
Use ASP. NET to create an application mainly composed of browser user interfaces. This naturally includes applications that the public wants to use through the World Wide Web, such as e-commerce applications. However, ASP. NET is not only used to create websites, but many other applications also apply to "thin clients", such as Internet-based employee manuals or allowance applications. Any ASP. NET application has an important advantage, that is, there is no client installation and maintenance costs. The user has installed the only required application-browser.
ASP. NET applications are platform independent, that is, they are "extended" applications. Users can interact with applications regardless of their browser type or computer type. At the same time, ASP. NET applications can be optimized to use the built-in functions of the latest browser to enhance performance and response capabilities. In many cases, this optimization is built into the Web forms component. These components can automatically detect the browser level and detect the rendering page accordingly.
ASP. NET applications provide some functions that are still useful in non-Web environments. Because these functions depend on HTML, ASP. NET applications are suitable for any type of text-intensive applications, especially those that are important to text format settings. Browser-based applications have limited access to your system resources. This restriction makes ASP. NET Applications very valuable when you want to prevent users from accessing certain applications.
Comparison between WinForm and ASP. NET
Functions/standards |
WinForm |
ASP. NET |
Installation and deployment |
WinForm allows you to use ClickOnce for "non-contact" deployment, that is, you can directly download, install, and run applications on your computer without changing the registry. |
ASP. NET is not deployed on the client; the client only needs one browser. The server must run Microsoft. NET Framework. Update the application by updating the code on the server. |
Graphics |
WinForm includes GDI +, which enables complex graphics for games and other environments with Rich graphics. |
In ASP. NET, interactive or dynamic images need to be accessed back and forth to the server for updates. You can use GDI + on the server to create custom images. |
Response |
WinForm can run completely on the client computer; they can provide the fastest response speed for applications requiring high interaction. |
If you use a newer browser (IE5.0 or later), ASP.. NET applications can use the dynamic HTML (DHTML) function of the browser to create rich, Responsive user interfaces (UIS ). If the user has other browsers, most of the processing tasks related to the user interface, such as verification, need to be back and forth to the Web server, which will affect the response, of course, we can use AJAX technology to improve the application experience. |
Form and text Flow Control |
WinForm grid positioning can provide precise two-dimensional x and y coordinates for the control position. To display text on a Windows form, insert the text to a control, such as a Label control, TextBox Control, or RichTextBox Control. Formatting is restricted. |
The ASP. NET interface is based on the HTML style stream layout. Therefore, all functions of the webpage layout are supported. It is particularly powerful in text format settings. You can manage control la s with certain restrictions, for example, controls that cannot overlap ). If you have a browser that supports DHTML, you can use two-dimensional x and y coordinates to specify a more precise layout. |
Dependencies on. NET Framework |
WinForm needs to run. NET Framework on the client computer. |
The ASP. NET client only needs one browser. Browsers that support DHTML can use additional functions, while Web forms can be designed to be applicable to all browsers. The ASP. NET system only needs to run. NET Framework on the server. |
Access the local resource file system, system registry, etc) |
If allowed, the application can have full access to local computer resources. If necessary, you can precisely restrict applications so that they cannot use specific resources. |
Browser security prevents applications from accessing resources on the local computer. |
Programming Model |
WinForm is based on the Win32 message dump mode of the client. In this mode, developers create, use, and destroy instances of components. |
ASP. NET relies heavily on the asynchronous disconnection model in which components are loosely coupled to the front-end of the application. Generally, application components are called over HTTP. This model may not be suitable for applications that require the user side to have a high throughput or applications with a large number of transactions. Similarly, ASP. NET applications may not be suitable for database applications that require high-level concurrency control. |
Security |
WinForm uses permissions in its code access security implementation to protect computer resources and sensitive information. This allows the function to be exposed with caution while retaining security. For example, the print permission allows printing only on the default printer at a certain level, and printing on any printer at another level. With ClickOnce deployment technology, developers can easily configure what permissions the application should and should not require to the client. |
In general, by verifying the requester's creden such as name/password pairs), you can access ASP. NET application resources by URL control. ASP. NET allows developers to control the identity used to execute server application code. Applications can use the Request Entity identifier to execute code. The application can also dynamically adjust the content based on the requester's identity or role. For example, a manager can access a site or higher-level content, but a person with lower permissions cannot. |
Author: Lu Zhonghua
Address: http://blog.whhpaccp.com/post-39.html