【问题标题】:SharePoint Publishing site HTTPModuleSharePoint 发布站点 HTTPModule
【发布时间】: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


    【解决方案1】:

    我通过将重定向代码移动到 PreRequestHandlerExecute 事件处理程序中解决了这个问题

    【讨论】:

    • 如果它解决了所描述的问题,您应该接受这个答案。
    猜你喜欢
    • 1970-01-01
    • 2012-03-04
    • 1970-01-01
    • 1970-01-01
    • 2011-06-15
    • 2011-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多