Question

I have created and implemented the IHttpModule interface in order to use the Session_Start event in SharePoint 2010 (like global.asax in asp.net). I have added the add tag into my web.config file in the modules section (because I use integrated mode) and I have also deployed my DLL to GAC, but I get this error:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

Does anyone know why this is happening?

Was it helpful?

Solution

The problem was in my module tag in web.config file.
It must be the full assembly name, not just the class name.
which in c# terms it can be the Assembly.FullName code.
For example i have a class which implemented IHttpModule like this:

public class StatisticsModule : IHttpModule
{
   public void Init(HttpApplication context)
   {
      context.ReleaseRequestState += context_ReleaseRequestState;
   }

   public void Dispose()
   { }
}

and this class placed in Shakib.Statistics Namespace, so for this example the Module Tag which should be in web.config and "modules" section, must be this:

<add name="Statistics" type="Shakib.Statistics.StatisticsModule, Shakib.Statistics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4d63664a8351e206" />
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top