This period of time in learning asp.net routing, HTTP processing and other content, understand some, but not fully understand, specious, no matter how, make a summary for future reference and modification.
First, IIS6 and IIS7 Classic mode and Integrated mode
In the classical mode of IIS6 and IIS7, the processing part of ASP.net is independent, and it is done by Aspnet_isapi.dll. A request is sent from the browser to the Iis,iis to determine the type of request, if the asp.net part, it is forwarded to the aspnet_isapi.dll to process, processed and then returned to IIS, and then returned by IIS to the browser.
In the IIS7 integration model, no matter what resources, what type, are completed in the same pipeline.
Reference articles:
Deep understanding of the pipeline mode for application pools in IIS 7
Http://tech.techweb.com.cn/redirect.php?fid=2&tid=496369&goto=nextnewset
asp.net lifecycle and HTTP pipeline technology
Http://www.cnblogs.com/refactor/archive/2012/07/06/2568742.html
In other words, I write an HTTP processing module (modular), program (handler), if in IIS6 and Classic mode, for static pages such as resources, but IIS7 integration mode, it can. Also, if I want to write an HTTP Handler to implement what route:
HTTP://WWW.TEST.COM/A.ACTION/ID/1 = = "Http://www.test.com/a.aspx?id=1, then
Under IIS6, you need to map a file with a suffix named. Action to Aspnet_isapi.dll
In IIS7 Classic mode, you need to register and declare in Web.config
In IIS7 Integrated mode, the simplest, only a little configuration
App_code/myhandler.cs
<summary>
///Handler Summary description
///</summary> public
class Myhandler:ihttphandler
{ Public
void ProcessRequest (HttpContext context)
{Context
. Response.Write ("
The web.config of IIS7 Classic mode
<!--
For more information about how to configure the ASP.net application, visit
http://go.microsoft.com/fwlink/? linkid=169433
-->
<configuration>
<system.web>
IIS7 Integrated Mode
<?xml version= "1.0"?>
<!--
For more information about how to configure the ASP.net application, visit
http://go.microsoft.com/fwlink/? linkid=169433
-->
<configuration>
<system.webServer>
Reference articles:
an overview of HTTP handlers and HTTP modules http://msdn.microsoft.com/zh-cn/library/bb398986 (v=vs.100). aspx
Second, ASP. NET routing
Routing is not a feature that is unique to MVC, and WEB form programs can be used entirely. The problem is, IIS6 and IIS7 Classic mode, because of the above reasons, the path must add suffix name, such as HTTP://WWW.TEST.COM/A.ASPX/ID/1,
Otherwise it will not work, the URL of the beautiful, friendly nature unavoidably discount.
Another problem is how to read the parameters after the route is adopted.
Accustomed to the traditional URL under the QueryString way. With routing, however, you cannot attach parameters to the target page as you would a common URL rewrite, such as
Routes. Mappageroute ("ProductInfo",
"Pid.ashx/{id}",
"~/handler.ashx?pid=");
I once thought that this {ID} could be appended to the target address, written in this way, hanler.ashx?pid=$1, and the result is not.
How is the parameter extracted? In the target page, use the page.routedata.values["..." method to extract. And if this page is an ASPX page, it's not ashx.
asp.net routing http://msdn.microsoft.com/zh-cn/library/cc668201 (v=vs.100). aspx
Third, url rewrite outdated?
Also has the route, but also has the custom HTTP processing module, the program, but also wants the URL rewriting to do. Microsoft has a rewrite module for IIS7, the other is Basterds, always a bit strange feeling.
(Refer to Flops http://blog.csdn.net/leftfist/article/details/9283141)
However, for IIS6 and IIS7 Classic schemas, URL overrides can handle static resource class addresses, proving that the IIS process is preceded by a asp.net step, which I believe is more performance than Routing and custom HTTP processing. and a variety of regular expressions, complex is a bit complicated, but after all, can be achieved quite well.
These different Web server features, we want to achieve a beautiful, friendly URL to consider.