ASP.NET development actual combat - (b) Why use ASP.NET

  The main contents of this paper is to analyze "blog system" requirements, determine the form of Web applications to develop, and then introduces the concept of HTML, HTTP, and use IIS to build a static HTML "page", which leads to "dynamic" ASP .NET.

  This article from the following aspects to introduce how to use ASP.NET:

  ● What ASP.NET is?
  ● Why Use ASP.NET?
  ● demand and realization of blog
  ● What is the Web, HTML, Web server

What ASP.NET is?

  ASP.NET is a use HTML, CSS, Javascript framework to build dynamic Web sites or Web applications, and can also use it to build web API and real-time communication technologies such as web soket.
  ASP.NET provides three framework to create web applications that are Web Forms, ASP.NET MVC and ASP.NET Web Pages, they are based on .Net and the .Net Framework and ASP.NET shared core functionality. Identity-based security authentication as the same request management facility, session handling, and ASP.NET is part of the core functions.
The most important thing is the three frameworks are not independent, they can be mixed appear in the same Web application.

  • Web Forms provides a rich set of components using HTML tags package for developers. Developers can use these controls like Win Forms application development as drag and drop controls and through event driven (click the button event to open the event page, etc.).
  • ASP.NET MVC provides a separation of duties development model, which will service the HTML code and code separation, TDD is a development-friendly way, can be used to develop complex applications.
  • ASP.NET Web Pages and Razor syntax provides a fast, simple, lightweight method that will service code and HTML mixed together to create dynamic Web content.

APIs Web:
  ASP.NET Web API is a framework for building HTTP-based services, can serve browsers, mobile devices and other clients.
Real-time technology:
  ASP.NET ASP.NET SignalR is a class library for developing real-time Web-enabled, SignalR support two-way communication before the client and server, SignalR support Web Socket, browsers that do not support it will automatically switch to other methods be compatible browser, such as a polling request and so on.

 

Why use ASP.NET

  Demand, demand, demand! ! !
  Relative to demand, ASP.NET development framework and other tools used to achieve the just demands. You must be clear before doing one thing what they want. For example, we would like to share their writing articles, so that can share their knowledge, may also attract people to discuss with the industry and then find their own problems, but also in the process of writing the article also consolidated his knowledge.
  How to achieve such a demand there any way to do that? Now is the information age, send, share the cost of the message is very low, such as the current QQ space, circle of friends, microblogging, blog, etc., you can easily publish information registered account, but for the blog article is only suitable, and now, like cnblog the blog are for programmers, can more easily attract the attention of programmers and discussion of the article. But as a programmer if it wants to have its own blog?
  This series of articles will build blog using this example in terms of v how to use ASP.NET to develop applications.

Demand analysis blog

  For the blog, the two important objects are "reader" and "author", is the need for a reader a directory, then you can quickly understand the content of the article points to the directory by directory titles, and include the title of the article is pointing address. Is not that a book? (* ^ _ ^ *).

  Of course, we can indeed make the article a book for readers to see even more convenient e-book, but for the author of the article, the author wrote the article just, and classification of many, and there is a link between the writings are not necessarily a book can not be synthesized, or need to merge multiple books, more importantly, can not wait until the publication of the article after the completion of all, if every write an article will be updated a book, then for the reader every time re-purchase, download the latest book is simply a disaster.
  So for the authors, it requires an easy to publish, modify articles platforms, even when a series of articles complete when it can be made into a book for readers to download. For readers, the need to provide a convenient entry, so that it could view the article directories and view the contents of the article through the directory. More may also need to be highlighted in a number of popular articles, and let more people participate in reviews.

  The following use case diagram drawn according to the above analysis:

  

  

  http://www.cnblogs.com/Yogurshine/archive/2013/01/14/2859248.html (with reference to FIG Example)

 Implementation requirements of

  How do we achieve these functions?
  ● publishing books
  ● Internet publishing
    ○ command line program (not available for convenient operation, is not conducive to view the article)
    ○ Windows Form program (can provide convenient viewing and publishing features, but readers and writers need to download and install the client, for the reader to says too much trouble)
    ○ Web (readers and authors are just a browser can connect to the system through the browser can be achieved to view and management functions)
    ○ mobile applications (as IOS, Android, Windows and other mobile systems provide application can provide the reader the most convenient reading experience, but not convenient authors edit articles, but also requires a lot of experience to develop applications for different operating systems. more importantly, there are browsers on smart mobile devices, it can also open Web applications, especially for mobile devices treated responsive page layouts, can provide a better reading experience for different device screen size.)

  So based on the above analysis we can easily elect to use "Web" to achieve our blog. What is the Web it? It ASP.NET and what relationship they exist?

What is the Web?

  Web (World Wide Web) that is the World Wide Web, also known as the World Wide Web, which is based on hypertext and HTTP, global, dynamic interactive, cross-platform distributed graphical information system. The establishment of a network service on the Internet, find and browse information provides a graphical, intuitive interface for easy access to viewers on the Internet, in which documents and hyperlinks to organize information into a node on the Internet each other associated network structure. (From Baidu Encyclopedia)
  Based on the above explanation may see Web-based hypertext and HTTP. Then a lot of features, here we have to pay attention to what is hypertext, what is HTTP.
  Hypertext: a user interface paradigm for displaying text and text-related content. Hypertext now generally exists as to the electronic document, which contains the text field or may be linked to other documents hypertext link, switching from a current reading position directly hypertext link points to text.
  There are many hypertext format, currently most commonly used HTML (Hyper Text Markup Language, HTML) and Rich Text Format (Rich Text Format, RTF). Our daily browsing links on the page are all hypertext. (From Baidu Encyclopedia)

  Simple to understand hypertext is used to display, you can jump through hyperlinks, and common hypertext format is HTML, you can open a browser to view the HTML file.

 Use HTML to create a "blog"

  According to the description on the face of Web can be drawn: The browser can open the HTML file, HTML file contains text information and connect jump specified HTML, so that we can solve the problem of the reader.

  Then begin to attack solve:
  1. Create a file directory as the HTML file (HTML structure, including the "head" section (English: Head), and "body" section (in English: Body), in which the "head" provided by the Ministry About information page, "subject" section provides the specific content of the web page .-- Baidu Encyclopedia):

  

  2. Create four articles HTML file:

  

  3. In the list of pages to four pages linked article:

  

  "Author" basic functions "Article Management" to "achieve", and for the authors of the article directories require only maintenance list.html file, then the article made a new post html files on it, then put these pages beautify completed the "author" of the article management function.

  But the "reader" to see how these articles? Mentioned before the Web is based on hypertext and HTTP, HTML is a hypertext is used to display the content, but now need to send the content to the "reader" view on the need to use HTTP.

What is HTTP

  HTTP protocol (HyperText Transfer Protocol, Hypertext Transfer Protocol) is a protocol used to transfer hypertext transfer from the WWW server to the local browser. It can make the browser more efficient, so that network traffic is reduced. Not only does it ensure that the computer correctly and quickly transfer hypertext document, the document also determines which part of the transmission, and which first part of the show (such as text prior to graphics) and so on.
  HTTP is an application layer communication protocol between the client browser and the Web server, or other program. On the Web server on the Internet are stored hypertext information, client needs hypertext transfer protocol HTTP information to be accessed through. HTTP contains the commands and transmit information, not only for Web access can also be used for communication between other Internet / Intranet applications, enabling a variety of applications hypermedia access to resources integration. ---Baidu Encyclopedia

  HTML uses HTTP protocol to transmit between the client browser and the Web server. This is the information given above text. Now HTML and browsers already have, leaving a shortfall of a Web server.

What is a Web server?

  Web servers generally refers to the web server, refers to some type of computer program that resides on the Internet, can provide documentation to the client Web browser, etc., [1] website files can also be placed, so that the world view; placing the data file for the world to download. The three most mainstream Web server is Apache, Nginx, IIS. -- Baidu Encyclopedia

  Commonly used on windows Web server is IIS. (How to install IIS: https: //jingyan.baidu.com/article/eb9f7b6d9e73d1869364e8d8.html) 

Use IIS issued "blog"

  Here the choice to deploy IIS on Windows HTML file written above:

  1. Open the IIS, add a Web site:

  

  2. Specify the physical file path to the new site (html file path that is just created), bind to port and start saving reform website:

  

  Through the loopback address of the machine or localhost 127.0.0.1 and LAN IP (may need to set binding ports in the firewall browser access: Control Panel -> System and Security -> Windows Firewall -> Advanced Settings -> inbound rules -> New rule -> port -> TCP, specific local ports, 12345-> Finish) to access the site:

  

  

  The following are displayed on the same LAN phone: 

  

  

Why Use ASP.NET?

  From the above results it looks as if the only blog page optimization, that ASP.NET needs to do? Then look at the breakdown of the above practice disadvantages:
  1. Each time you publish all of the need to produce an HTML file, modify the content also need to modify the HTML file, the more management more difficult. And the author also need to know HTML knowledge.
  2. If you want to modify the page style 100 100 file modification times.
  3. The article can not count the number of access (of course, can be obtained by analyzing IIS logs).
  4. can not provide comment functionality to users.
  The function can not develop more features, and more.

  Beginning of the article said: ASP.NET is a framework to build dynamic Web sites or Web applications using HTML, CSS, Javascript.

  Using ASP.NET can easily build a "dynamic" website, all data exists in the database, loading list of articles from the database through a list template page by page to a paper template database loads the appropriate article shows, add a management page the authors provide management functions, and finally by the author only limit to enter the administration page through authentication mechanism, then the above problems will lead edge solution. More importantly, we can also fulfill the functions of the blog through a number of mechanisms provided by ASP.NET to expand such as reading data records, sorting, comments and so on. So use ASP.NET as a development framework program development blog.

  (Note: In addition to ASP.NET can also use PHP, JSP, NodeJS development frameworks such as the completion of the above functions, but also as a demo does not need to consider many complex issues, so I chose ASP.NET real reason is that "I like my wayward! . ")  

 

reference:

  https://docs.microsoft.com/zh-cn/aspnet/overview

  http://www.cnblogs.com/Yogurshine/archive/2013/01/14/2859248.html (with reference to FIG Example)

 

 

Welcome to add a personal Micro Signal: Like if thoughts.

I welcome the attention of the public numbers, not only recommend the latest blog for you, there are more surprises waiting for you and resources! Learn together and common progress!

 

Guess you like

Origin www.cnblogs.com/cool2feel/p/11544443.html