Digress: since last year, I have successively written some original articles, many of which are a summary of the original projects. Therefore, it is not very systematic and comprehensive. It is written for a certain knowledge point or a specific application. Some friends suggested that I write my own experience into a system. This is an attempt, if not, please try to throw tomatoes and don't drop bricks.
There are some reasons for calling this series "Asp.net". The more you drink, the more confused you are, the more you drink. I am very busy during the day, so I will cook a pot of tea and read a book while drinking tea every day when I return home. I will use text to record my experiences and sort out these words after a while, I think the statements are still smooth and I posted them on my blog. This article on the Asp.net series will be completed at night, so I call it "Asp.net". This series focuses on the introduction of theory and experience in Asp.net development practice.
Macromedia Dreamweaver 8, Microsoft Visual Studio 2005, and Microsoft SQL Server 2005 are used in this series of articles. Install the relevant software first.
Now, let's get started.
Today I will introduce the following knowledge points:
XHTML Language
Static webpage
Dynamic Web Page
Web Server
Prerequisites for Asp.net Development
In addition, when reading this section, I may use Macromedia Dreamweaver 8 Chinese version. If possible, installing Macromedia Dreamweaver on my computer will provide a better experience.
XHTML Language
In the early stages of web development, HTML was basically used for development. Because of its loose syntax requirements, it is easier for developers to process machines, therefore, XML requirements are added based on HTML, which forms the XHTML language. To put it bluntly, XHTML is an HTML language that complies with XML standards. Currently, both Macromedia Dreamweaver and Microsoft Visual Studio support XHTML development.
The following is an empty HTML page created by Dreamweaver:
The following is a blank ASPX page created by Microsoft Visual studio2005:
Note that the section marked with the red line indicates that the page we created conforms to the XHTML standard. This is because some pages written by beginners do not conform to the standard and cannot be viewed on the View Interface in visual studio2005.
Static webpage
Early web pages used static Web pages. The so-called static Web pages do not contain code that needs to be executed on the server. For example, if an HTML webpage with special JavaScript effects or an HTML webpage with Flash is displayed on the webpage, even the code is run, but the code is executed on the client, so it is not a dynamic page.
The advantage of static Web pages is that the server simply needs to generate HTML for the webpage to the browser. The disadvantage of static mode is that it is difficult to maintain and the database cannot be used.
Dynamic Web Page
A dynamic web page contains code that needs to be executed on the Web server. When we request a dynamic webpage to the Web server, the web server directly sends the HTML code to the browser, and for the code that needs to be executed on the Web server, naturally, the web server executes this part of code and sends the final execution result, namely, HTML code, to the browser, because the browser does not know the dynamic code. That is, the dynamic web pages written in whatever language are HTML code when they arrive at the browser.
Of course, for dynamic web pages written in different programming languages, the web server will run the code in different ways. More specifically, the web server will hand over the code to different programs for execution, these code execution programs are called script engines. The Web server sends the execution results of these script engines to the browser. Currently, common dynamic web pages such as JSP, ASP, PHP, and Asp.net are supported.
Web Server
The Web server is used to accept client browser requests and decide how to display webpage content based on client browser requests. When we open a webpage or another file, the web server will set how to deliver the file content to the client.
Currently, popular Web servers include IIS (Internet Information Server) and Apache. The former is developed by Microsoft and has always been simple to use. It runs on a Windows operating system, while Apache is an open-source software with Windows and Linux versions. We mainly use IIS for Asp.net development.
Note that IIS may not be installed by default in some systems. You need to install IIS manually. The procedure is as follows:
Open the control panel, find "Add/delete Windows components", and click the open interface, as shown below:
Select the "Internet Information Service (IIS)" option and place it on the system installation disk. Click "Next" to install it.
When deploying the Asp.net website on the server, the. NET runtime environment. NET Framework is required. Net frameworkle is similar to the Java JDK, including the. NET runtime environment and command line compiling tool. If the. NET Framework is not installed on the server, download it from the Microsoft Website: http://msdn2.microsoft.com/zh-cn/default.aspx. Note that if you install the SDK first. net Framework to install IIS again, you need to run a command to register with IIS.. NET Framework. This command can be found in the system partition. If the operating system is installed on the C drive and the C drive is installed. if the Net Framework version is 2.0, the path of this file is: C:/Windows/Microsoft. net/framework/v2.0.50727/aspnet_regiis.exe, enter "C:/Windows/Microsoft. net/framework/v2.0.50727/aspnet_regiis.exe-I ", for example:
Click "OK" to complete registration.
We may wish to further explore the server. When we run the IIS software, we will see the following interface:
Click the "default website" node and select "properties" in the pop-up menu. The following page is displayed:
We can see eight tabs in total, they are website, ISAPI filter, Home Directory, document, Directory Security, HTTP header, custom error, and ASP.. Net tab. This section describes several tabs that are commonly used for configuration.
"Website" tab: the website tab is used to configure some common attributes, such as the port number and IP address used by our website. The default web server port is 80. We do not recommend that you modify it.
"Main directory" tab:
On the "home directory" tab, you can set the physical path of the website or virtual directory, and the execution engine of dynamic web pages. Click the "configuration" tab. The interface is as follows:
As shown in the preceding figure, the ASPX page can be correctly executed after IIS and. NET Framework are correctly installed. Select. aspx and click Edit. A new interface is displayed, as shown below:
We can see that the. ASPX page is executed by aspnet_isapi.dll. If a custom file needs to be processed by the server, we can configure it here.
"Document" tab:
This interface is used to set the start page of a website or virtual directory. When we open a website or virtual directory, if we do not specify which webpage to access, the Web will open a page. For example, if we enter www.163.com in the address bar of the browser, the Netease homepage will be opened. In fact, we do not specify which page to access. The server uses a default mechanism to open a specific page. In the above interface, we set multiple pages as the start page. IIS will check whether there is a corresponding page for our website or virtual directory in the order from top to bottom. If a qualified webpage is found, stop searching and send the current page to the client browser.
"ASP. NET" tab
If multiple. NET Framework versions are installed on the current machine, you need to set the Asp.net version for each website or virtual directory. This must be consistent with the. NET version used during development. The Asp.net website developed by Visual studio2002 requires. NET Framework 1.0, the website developed by Visual studio2003 requires. NET Framework 1.1, and the website developed by Visual studio2005 requires. Net framework2.0. Because. NET Framework 1.1 and. Net framework2.0 are installed on my machine, there are two. NET Framework versions available in the drop-down box. For example:
In addition, a special folder is introduced. It is located under the system partition, such:
Because my system partition is C and IIS uses. Net framework2.0, the folder is C:/Windows/Microsoft. NET/framework/v2.0.50727/Temporary ASP. NET files. This folder is used to store DLL files generated by our Asp.net webpage. We can use Dreamweaver to create a simple Asp.net webpage test. ASPX page. The steps are as follows:
Open Dreamweaver, select "new", and select "dynamic page" and "Asp.net C #", for example:
You do not need to enter any code to save the file to the inetpub/wwwroot directory under the system partition (because my system partition is C, it is C:/inetpub/wwwroot ), the file name is test. aspx. Enter http: // localhost/test. aspx in the browser, and a blank page is displayed. But now let's look at the C:/Windows/Microsoft. NET/framework/v2.0.50727/Temporary ASP. NET Files Folder. At this time, a sub-Folder root is added, such:
We continue to open this folder and will find the following situation at the end:
That is to say, after opening the blank test. ASPX page we just created in the client browser, the DLL file will be generated under the corresponding. NET Framework running version.
Use the ildasm tool to open the DLL file. We can see the internal information of this DLL file (Note: ildasm is followed.. NET Framework released together and viewed by users.. Net code ).
The DLL file contains ASP. test_aspx.
In fact, when we first open the Asp.net webpage, the corresponding webpage will be compiled into a DLL file, and then JIT will run the DLL file. Once this file changes again, the next time you request this web page, it will be compiled into a DLL file. To prevent duplicate file names, the generated DLL file is named randomly.
This is where the Asp.net webpage is different from ASP or PHP: The Asp.net page will be compiled into a DLL file during the first request and executed by JIT compilation, therefore, the first time the ASPX page is opened, it is slow, and it will be executed later, because there is no need to re-generate a new version unless the code is modified later. while ASP and PHP Web pages are interpreted and executed every time they run, the Asp.net website runs faster.
Note: This article was originally published by Zhou Gong. The original Article address is:Http://blog.csdn.net/zhoufoxcn/archive/2008/09/12/2915811.aspx, This note, because the size and download speed of personal space are limited, you will not be able to download the test video tutorial ASP. NET nightfall from your host in the future. You can go to www.verycd.com. The address is: http://www.verycd.com/topics/2730883/, online viewing URL is: http://developer.51cto.com/developer/aspdotnet/
Asp.net Night Talk Series:
- Asp.net: Introduction to Asp.net
- Asp.net night talk II: Asp.net built-in object
- Asp.net night talk 3: forms and controls
- Asp.net evening 4: skills that are easy to ignore in Visual Studio 2005
- Asp.net night talk 5: page class and callback Technology
- Asp.net evening 6: Basic Asp.net controls
- Session 7 of Asp.net: Ado. Net Introduction
- Asp.net: Controls for Data Binding
- Asp.net evening call 9: verification controls
- Asp.net Theme 10: Composite controls and dashboard pages
- Asp.net session 11: Web. config