C#伪地址的应用
建立httpModule
<httpModules>
<add type="WebSite.MyModule1" name="MyModule1"/>
</httpModules>
</system.web>
public void Init(HttpApplication context)
{
// 下面是如何处理 LogRequest 事件并为其
// 提供自定义日志记录实现的示例
//context.LogRequest += new EventHandler(OnLogRequest);
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
HttpContext context = ((HttpApplication)sender).Context;
string requestpath = context.Request.Path.ToLower();
if (requestpath.IndexOf("news")>0)
{
context.RewritePath("../WebForm1.aspx");
}
}