I found solution. It's very easy by using HttpModule. Please look at my following example code.
In global web.config
<configuration>
<system.web>
<httpModules>
<add name="RedirectModule" type="MySolution.RedirectModule, MySolution" />
</httpModules>
</system.web>
<!-- The following code will be used by IIS 7+ -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="RedirectModule" />
<add name="RedirectModule" type="MySolution.RedirectModule MySolution" />
</modules>
</system.webServer>
</configuration>
In MySolution/RedirectModule.cs
using System;
using System.Web;
namespace MySolution
{
public class RedirectModule : IHttpModule
{
#region IHttpModule Members
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(HttpApplication_BeginRequest);
}
public void Dispose() {}
#endregion
void HttpApplication_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
if (*[logic for checking before redirect]*)
{
app.Response.Redirect(*[url]*);
}
}
}
}
For more infomation, Please look at Url Mapping source code like UrlRewritingNet.UrlRewrite.
PS. IHttpModule is very powerful interface. It can handle with every request type. So, It can help me to completely solve this question.