Saturday 24 September 2011

Registering Http module in CRM 2011

We had a requirement of showing Terms and Condition page for the first time logged in users of IFD CRM.

We created a http module and registered a webresource as a T & C page.

To build http module.

Create a class library project
add the assembly of System.Web, and Implement the interface IHttpModule

Sign the assembly, by going to project properties and selecting signing tab, and then select sign the assembly,
Then enter following command and replace <<dll name>> with the acutall dll generated.

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe -Tp <<dll name>>

http://www.crmexper.com/?p=82

Paste the http module dll into the following folder
C:\Program Files\Microsoft Dynamics CRM\CRMWeb\bin

Open the web.config file present at following folder
C:\Program Files\microsoft CRM\CRMWeb

and add the following line where other http modules are already present
      <add name="TNC" type="NS.TandCModule, TandC Http Module, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d4bbd2a97381a7c1" />

Here,
name is any unique httpmodule value
NS.TandCModule basically represent the fully qualified namespace and class name
TandC Http Module, is the dll/assembly name which I copied into bin folder
Version=1.0.0.0, is the version of dll which can be checked by going to project properties->assembly and then pressing the Assembly information button.

PublicKeyToken is the value which is shown when used the sn.exe command

There is no need to restart IIS for website to pick the HTTP module.

No comments:

Post a Comment