Skip to main content

A Step-by-Step guide to use HttpModule in SharePoint with SPContext

I guess you must be familiar with what is HttpModule and how can we leverage it for our web applications. But if not, better have a good read of this article.

SharePoint is built on top of .NET, so it has all the rights to use the beauties of .NET.

Here I want to demo a simple case of httpmodule on SharePoint. Say if in a company it has lots of site collections and user 'Picky Docky' has access for all of them, for a reason farm administrator want to block him for one of the specific site without change his SharePoint permissions. Here are the steps to do it:-)

 
  • Create a empty SharePoint solution
  • add a class file to it named  CustomSecurityModule.cs, code as below
  • Create a feature and scope to "WebApplication"
  • Create a feature receiver. Code as below
  • When activate the feature it will create a modle in the web.config file for the SharePoint web applicaiton you deployed to as below:
Enjoy!

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. I was trying to get rid of the error: "Could not load file or assembly 'RSSharePointSoapProxy" from my Site Collection.

    This article gave me a clue to get my SharePoint site back up and running after it got hosed when I was trying to install ReportingServices and ReportingServices Integration, and then uninstalled the Reporting Services Add-in for SharePoint Products. I am using SharePoint 2016 Enterprise Onsite (not Office 360) and SQL Server 2016 STD Ed. in a HyperV virtual machine.

    This article does not directly address this problem, but it showed me what I should have already known or remembered that there are a bunch of ASP.NET configuration stuff in the web.config for the SharePoint VirtualDirectory in IIS that needed to be removed!

    Search in this web.config file for "Report" and "ReportingServices" and "RSSharePoint" and remove (intellegently) the section in this web.config file for it and save it.


    And then stop and restart the IIS and SharePoint Timer services after you are finished.* When I was done doing this in the correct web.config file I had to wait a little then the welcome logon screen popped up, and after a little bit of waiting my site collection was back up and running!

    (When I had run the SQLServer 2016 STD Setup and uninstalled the Reporting Services Add-In, it appeared to work, but failed to take out these entries in the web.config.)

    ReplyDelete

Post a Comment

Popular posts from this blog

How to add Lync presence to a SharePoint 2013 page

1. Add a "Snippet Editor" web part to the web part zone 2. Press "Edit Snippet" 3. Insert the following Snippet, replace the highlighte d parts with correct value <span class="ms-imnSpan"><a class="ms-imnlink ms-spimn-presenceLink" onclick="IMNImageOnClick(event);return false;" href="#"><span class="ms-spimn-presenceWrapper ms-imnImg ms-spimn-imgSize-10x10"><img name="imnmark" title="" class="ms-spimn-img ms-spimn-presence-offline-10x10x32" id="imn_1,type=smtp" alt="Offline" src="http://dpgintranettldev/_layouts/15/images/spimn.png" sip=" Your Email Address " showofflinepawn="1"></span></a></span><span class="ms-noWrap ms-imnSpan"><a class="ms-subtleLink" href="#"> Your Name </a></span> 4. Save - ...

SharePoint 2013: Unexpected response from server issue and how to fix

From time to time when you do some operations such as search using SharePoint 2013 you may see the following error: Unexpected response from server. The status code of response is ’500′. The status text of response is ‘System.ServiceModel.ServiceActivationException’ After having this issue on newly installed SharePoint 2013 farm in production environment, I figure it out that Single server is running out of memory. Especially, thanks to one new process noderunner.exe. Noderunner.exe is the new executable of search service on SharePoint 2013. This process can’t turn it off because Search is one of essential service application in SharePoint 2013, and it is integrated in many features. So, there are some things you can do to reduce the impact of Search on your system. Solution 1 Reduce the Search Service Performance Level with this PowerShell command: Set-SPEnterpriseSearchService -PerformanceLevel Reduced or Set-SPEnterpriseSearchService -PerformanceLevel PartiallyReduced,...