【发布时间】:2010-11-24 13:12:04
【问题描述】:
我为重定向目的编写了一个HTTPModule,并安装在 GAC 中并在根 web.config 文件中引用。它非常适用于团队网站。
我正在使用PreRequestHandlerExecute 查看请求是否为页面并调用
public void Init(HttpApplication context)
{
this.app = context;
this.app.PreRequestHandlerExecute += new EventHandler(Application_PreRequestHandlerExecute);
}
void Application_PreRequestHandlerExecute(object source, EventArgs e)
{
Page page = HttpContext.Current.CurrentHandler as Page;
if (page != null)
{
page.PreInit += new EventHandler(Perform_Redirection);
}
}
在Perform_Redirection 方法中我正在做重定向的东西。
void Perform_Redirection(object source, EventArgs e)
{
//logic goes here for redirection
}
上述代码适用于 Teamsites,但不适用于发布网站。 Page.PreInit 不会因为发布网站而触发。
请帮我解决这个问题!
我使用PreRequestHandlerExecute,因为我需要会话对象和其他详细信息,否则我会使用BeginRequest。
【问题讨论】:
标签: sharepoint-2007 redirect httpmodule url-rewriting