Review:
1. Analysis of QBlog technology principles in the autumn Garden: Opening part: Overall understanding (1) -- introduces the role of the overall folder and file
2: Analysis of QBlog technical principles of the autumn color Garden: Understanding the whole site processing process (2)-introducing the business processing process of the autumn color Garden
3: Analysis of QBlog technical principles in the autumn color Park: UrlRewrite's principle of URL without a suffix (3) -- introduces how to implement URL without a suffix
Appendix:
In order to accelerate the open-source speed and better development of the Data frameworks of the autumn garden and CYQ. Data,
We are currently looking for open-source team members who are interested in entrepreneurial entrants,
Welcome to see this post:Qiu seluan [CYQ. Data] Open Source team search
OK. Go back to the question:
I. Positioning System of the autumn Garden
As we can see from the above section, the redirection principle of the autumn garden is to locate an arbitrary original request to the corresponding processing program, which can be aspx or ashx.
First upload an image:
We can see that there are a lot of ashx processing programs. How are these processing programs scheduled to work?
See: the internal URL positioning system of the autumn Garden:
System positioning:
Http://www.cyqdata.com/main site (technical channel) request, to: Home_Tech.ashx
Http://www.cyqdata.com/health Health Channel request, located to: Home_Health.ashx
Request for http://www.cyqdata.com/sys/login sys (including logging out of registration), located to: RegLogin. ashx
Http://www.cyqdata.com/error Error request, locate: Error. ashx
User positioning:
Http://www.cyqdata.com/qblog user blog, to: Index. ashx
Http://www.cyqdata.com/qblog/admin user background, go to: Admin. ashx
Http://www.cyqdata.com/qblog/article user Article, go to: Article. ashx
Http://www.cyqdata.com/picture/photo/ user image, will go to: Photo. ashx
Rss positioning, including the main site and users:
Http://www.cyqdata.com/rss
Both http://www.cyqdata.com/qblog/rss are positioned to Rss. ashx
There is also a Home. ashx
It turns out that there was only one main station before the V2.5 of the autumn garden. After the "Health Channel" was added, the old strategy of the autumn garden was changed to transform the main station into a channel, technical channel, so there are three channels:
Technical channels, Health channels, and user channels.
According to the configuration file, you can locate the main site to any channel. Simply put, there is no main site in the autumn Garden, but you direct www to a channel, so a channel becomes the main site, such a processing method is conducive to expanding the content of N channels, and the main site can be specified at will.
Ii. Internal Logic of redirection
After learning about the positioning system direction of the autumn Garden, the internal details should be resolved.
When UrlRewrite receives a strange request, you need to do the following:
1: Determine whether the URL needs to be located
Simple Analysis: For images, js, and css, you need to return directly because no redirection is required.
For some simple objects that require redirection, for example, direct. mdb and. ashx files, you can redirect them to error. ashx to process them and inform users that direct access is not allowed.
2: analyze the URL, whether it is a master site request or a user request
Because the main site request and user request are different, for example:
Http://www.cyqdata.com/health this is a system Channel
Http://www.cyqdata.com/qblog this is just a qblog user
Then we have to analyze it. The practice of the autumn garden is to store the main site keywords, not all of which are set as users, and reserve those with a length less than 4 for the system.
3: separation of key parameters
You can't transfer the requests to the corresponding ashx processing program. This will increase the workload of ashx. Therefore, it is necessary to do a good job in this step.
In the autumn garden, three parameters are divided: u = {0} & type = {1} & para = {2}
3.1: User name: Find the keyword user name from the URL
For example, a request with a URL in the following format:
Qblog.cyqdata.com
Www.cyqdata.com/qblog
You need to extract u = qblog from it. If the system keyword is retrieved, It is null.
3.2: Type: Search for keywords such as article, phpto, health, and tech from the URL.
For example, a request with a URL in the following format:
Www.cyqdata.com/qblog
Www.cyqdata.com/qblog/article
Www.cyqdata.com/qblog/photo
You need to extract type = article or type = photo from it. If not, the default value is index.
3.3: original request address:
In some business processing, you need to record the URL of the original request. At this time, you can easily get
4. Handling other details
In addition to the above key points, the autumn garden also handles many other details, such:
4.1: virtual directory
What is the situation?
Simply put, a virtual host is purchased. The host supports one site and N sub-directories at the same time. The so-called subdirectory is generally to create one more folder under the host directory to store the site.
What happens?
When obtaining the physical path of the request, there will be an extra level of virtual directory, resulting in many problems.
For example, if your A file is linked to href = "/qblog", it will be resolved to www.cyqdata.com/qblog.
If you are on a subdirectory site, resolve it to www.cyqdata.com/directory name/qblog
Solution?
The configuration method is used in the autumn garden, and then the sub-directory name is removed during the request.
Summary:
This section describes the positioning system of the autumn garden and analyzes its basic URL resolution redirection system. We can see that the autumn garden does not use configuration files + Regular Expressions for parsing, instead, you can resolve the url, perform manual classification, and locate the method in the corresponding processing program.
Next, we will introduce Module. dll,
How to be the father (base class) and create a lifecycle.