The underlying operations of asp.net have also been talked about. Today, let's take a look at the URLRewrite method.
IIS receives the request --> ISAPI is used to process the request --> BeginRequest start --> EndRequest end --> Output Response
There are a lot of other processes in the middle, which are not marked. Here we only list the processes that URLRewrite uses.
In fact, the RewritePath method of HttpContext is called in the BeginRequest event, and the request is "located" to a target URL.
Add the code in the Global inrequest method of the Global. asax file of the site:Copy to ClipboardReference: [www.bkjia.com] public class Global: System. Web. HttpApplication
{
Protected void Application_BeginRequest (object sender, EventArgs e)
{
HttpContext context = HttpContext. Current;
If (context. Request. Path. Equals ("/demo", StringComparison. InvariantCultureIgnoreCase ))
{
Context. RewritePath ("~ /DemoList. aspx ");
}
}
}