Revisit URL Rewrite (1): IIS and ASP.net

Source: Internet
Author: User
Tags iis

I thought this topic had been abused before. URL Rewrite has already been accepted by the vast number of developers, the Internet on the URL rewrite components and articles are endless, but always let me feel the meaning of the unfinished, so eventually can not help to write this series of articles. These articles do not talk about the value and meaning of URL rewrite, but only the content of pure technology. The article will not have a detailed analysis, but combined with my experience, from the application point of view to explain the topic. What you already know, what you don't know, what you've already talked about elsewhere, or what you haven't talked about, hopefully the "asp.net" of this series will not dull you, and will give you an idea of all aspects of the URL rewrite in the paper. If you later encounter the URL rewrite aspect of the problem is to be able to think of these several articles, I guess I will laugh aloud.

To fully understand the topics discussed later in this article, we must briefly understand the communication process between IIS and asp.net. I am here to explain the IIS 6 server. As for IIS 5 and IIS 7, the former can be said to have been eliminated, while the latter's "Classic mode" is the same as IIS 6, while the new "piping mode" is actually talking about some of the concepts in asp.net with the deep integration of IIS. I believe that if you understand IIS 6 and ASP.net, there is no problem with IIS 7 in Integrated mode.

First, let's look at a simple schematic showing the main steps that IIS starts with receiving the request, to the whole process of returning to response:

IIS receives the request.

Depending on the characteristics of the URL and the configuration in IIS, the selector selects an ISAPI to process the request--and now naturally chooses ASP.net ISAPI.

Asp. The net execution engine receives the request and initializes the data (such as building various objects).

Start triggering various pipeline events, naturally starting with beginrequest.

After a number of pipeline events, ASP. NET is configured to select a suitable handler or handlerfactory for the current request (special cases, for example, have been directly outputting the result in the previous event and ending the request).

After the handler processing and after several pipeline events, to endrequest end.

Output response.

In a asp.net application, if a URL Rewrite is to be made, the HttpContext RewritePath method is typically invoked in the BeginRequest event to reposition the request to a target URL. For example, we can rewrite the Application_BeginRequest method in Global.asax to achieve this:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.