.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Getting SharePoint to recognise HttpModule

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :SharePoint

I have an HttpModule declared in a feature like so

public class NhibSessionBuilderHttpModule : IHttpModule

The web config in the IIS 80 port is

  <identity impersonate="true" />
   <allow users="*" />
	<add name=

View Complete Post

More Related Resource Links

Using HttpModule to change master page dynamically on SharePoint 2010 site


I am trying to change master page dynamically on SharePoint 2010 site. I reviewed some documents (SharePoint: Dynamically Change Master Page: http://ranaictiu-technicalblog.blogspot.com/2009/10/sharepoint-dynamically-change-master.html) and I implemented IHttpModule, added it to GAC, modified web.config(safecontrol, httpmodule, module)
It works good! But I found some problems
1.Never catch the PreInit event for publishing pages
2."/_Layouts/RedirectPage.aspx" page occurred error
3.ContextMenu did not work

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using Microsoft.SharePoint;
using System.Configuration;
using Microsoft.SharePoint.ApplicationRuntime;

namespace MasterUtilModule
    public class MasterModule : IHttpModule
        public void Dispose() { }
        public void Init(HttpApplication context){

Problems with SharePoint Publishing site and HTTPModule preInit

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.

HTTP 401 when adding a HttpModule to SharePoint 2010 on RPC request


We need to add a HttpModule from .NET to capture some requests (including FrontPage ones). Everything works fine on the web UI side, but we encounter unexpected beahvior when trying to open a Word document : the user keeps being prompted for his credentials. Canceling the dialog boxes opens the Word document as read-only and we are unable to enter modification mode.

The server is a W2K8 running a Microsoft SharePoint Server 2010 (14.0.4763.1000). The site runs under II7, with its pipeline.

After digging a bit, we found out that this simple line in the HttpModule breaks everything :

void OnPostAuthorizeRequest(object sender, EventArgs e)
  HttpApplication application = sender as HttpApplication;
  string method = application.Request.Form["method"];

(as you may guess, we register to the OnPostAuthorizeRequest event).

If we comment out the 'string method = ...' line, everything works fine !

Activating IIS7 pipeline traces, we found out that the request which fails when the line is uncommented is on URL _vti_bin/shtml.dll/_vti_rpc and 2 warnings are recorded :
- ERR 403 (FORBIDDEN), Module : IsapiModule, Notification : EXECUTE_REQUEST_HANDLER
- followed by ERR 401 (Unhautorized); module : SPRequestModule, Notification

HOWTO Make a HttpModule for use with SharePoint 2010

HOWTO Make a HttpModule for use with SharePoint 2010

I'm trying to make my own custom HttpModule for SharePoint 2010. The only steps I am aware of are as such:

1) Make a class derrived from IHttpModule. 2) Edit web.config, add the following:
    <add name="MyClassName" type="MyNameSpace.MyClassName, MyDllName" preCondition="integratedMode"/>

3) Edit web.config, add the following under <SafeControls>:
  <SafeControl Assembly="MyDllName" Namespace="MyNameSpace" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="True" />

My HttpModule is not invoked at all. No error, even with SharePoint's logs all turned on. Nothing. What am I missing?

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Displaying SharePoint lists in Web Parts

When you create a built-in or custom list in Microsoft Windows SharePoint Services, Windows SharePoint Services creates a Web Part, a basic building block of a SharePoint site, to display that list. These Web Parts are called List View Web Parts. Windows SharePoint Services stores List View Web Parts in the site collection Web Part gallery. (The site collection Web Part gallery is the most central gallery of Web Parts for a work group. By default, the gallery name is the name of the site, such as "Our Team Site Web Part Gallery." )

Take a tour of your SharePoint site

What is a SharePoint site for?
A SharePoint site is a Web site that provides a central storage and collaboration space for documents, information, and ideas. A SharePoint site is a tool for collaboration, just like a telephone is a tool for communication, or a meeting is a tool for decision making. A SharePoint site helps groups of people (whether work teams or social groups) share information and work together. For example, a SharePoint site can help you:

Coordinate projects, calendars, and schedules.
Discuss ideas and review documents or proposals.
Share information and keep in touch with other people.

Six easy ways to customize your site using Web Parts in SharePoint

Becoming familiar with Web Part customization techniques gives you a range of page-customization choices. For example, you can customize your site's home page so that it displays the specific information that your team needs. You can rearrange the list items on the home page, add lists, and even change the images on the home page. As you become more familiar with Web Part Page customization techniques, you can build interactive Web Part Pages that makes the data in lists more dynamic and useful, and you can add new Web Parts that provide access to external data and Web services.

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

Out of the Depths of SharePoint's XML Hell

I described how a new open source tool called sporm significantly simplifies unit testing SharePoint. Making SharePoint unit testable is my absolute favorite feature of sporm because SharePoint is notoriously hard to unit test. But sporm provides other benefits as well and its ability to pull us out of the depths of verbose loosely typed XML hell and into LINQ excellence is next on my list of favorite features. So in this post I'll describe the pre-sporm technique of querying with CAML, how to query data using sporm, and finally how sporm supports SharePoint's unique architecture of allowing multiple content types per list and what that means to you.

Unit Testing SharePoint - Past, Present, and Sporm

As I described in SharePoint: The Wild West of Software Development there is a serious problem when you develop for SharePoint: ensuring quality through unit testing is really, really hard. And that's where a new open source tool just released today called sporm (SharePoint Object Relational Mapper) comes in. While sporm provides many benefits besides simplified unit testing I wanted to focus on this topic first, because sporm's approach, which models the entity framework in the way it supports POCO's, is a unique feature not available with other SharePoint tools like LINQ to SharePoint.

SharePoint Tutorial - Web Parts

A page in SharePoint is comprised of web parts the exist within zones. Web parts are available for just about everything. For example in the page below there are four web part highlighted by different colors. The purple web part displays a short list of the new announcements stored in the annoucements library. The pink web part displays events from a calendar within the site. The green web part displays an image from a location the user specifies. The gray web part displays a list of links from the links list on the site.

SharePoint Tutorial - Team Sites

Team sites are small web sites that are created to store everything about a particular thing. For example a site can be created for a department in an organization like human resources. I site can be created for a particular project. A site can even be created for a meeting. Everything about the thing (department, project, meeting) like documents, lists, calendars, etc. is stored in that site.

SharePoint Tutorial - Libraries

A library is a feature in SharePoint that stores files (documents). Think of a library as a folder on your file system. For example, a library can be created to store resumes in the human resources team site. A library is usually created for a specific type of file. Libraries can contain metadata to describe the particular file in more detail and to make it easier to find.

SharePoint Tutorial - Lists

A list is a feature in SharePoint that stores a lists of information. For example, a list can be created to store web links in the human resources team site. A list is usually created for a specific type of information. Lists can contain metadata to describe the particular information in more detail and to make it easier to find.

SharePoint Tutorial - Security

Security in SharePoint is comprised of users, groups and roles.

Users, Groups and Roles

A user account comes from the authentication system. For example, if Active Directory is used to authenticate then the user accounts will come from it.

There are two types of groups SharePoint uses: domain groups and SharePoint groups.

SharePoint Tutorial - SharePoint Logical Architecture

The SharePoint logical architecure consists of nested and isolated levels. These levels provide benefits for security, navigation, search, branding and ect. depending on the level

SharePoint Farm
The base level for any SharePoint implementation is the SharePoint farm. Physically a farm can consist of one server or many servers. An organization may implement one or more farms. This usually depends on security and performance needs.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend