Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Problems with SharePoint Publishing site and HTTPModule preInit

$
0
0
Hi All,

I have written an HTTPModule for the redirection purpose and installed in GAC and referenced in root web.config file. It is working for Team sites very well.

I am using PreRequestHandlerExecute to see the request is page or not and calling

  
 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);
      }
    }


and in the Perform_Redirection method I am doing the redirection stuff.

void Perform_Redirection(object source, EventArgs e)
  {
   //logic goes here for redirection
  }

The above code working fine for Teamsites but not for Publishing sites. The Page.PreInit is not firing for publishing sites.

Please help me to solve this problem!

I am using PreRequestHandlerExecute, because I need session object and other details otherwise I would have used BeginRequest.

Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>