Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
Please post the add tag you're adding to the web.config. I bet there's a problem with the format of the assembly reference. –  James Love Jul 18 '11 at 19:15
1  
i create a class library with vs 2010 and .net 3.5 with the strong name key file and my namespace and assembly name is "OnlineUsersHTTPModule" and my class name is "OnlineUsersModule" and i deployed the output dll to GAC and also add this tag to web.config in modules section: <add name="Test" type="OnlineUsersHTTPModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=78aac1459052cd0a" preCondition="integratedMode" /> –  Jalali Shakib Jul 19 '11 at 4:27
    
Did you find the answer for this problem? :) I have the same problem. –  Marlou Mar 15 '12 at 11:10
1  
yes i did. the problem was in my module tag in web.config file. so i check that again and fixed it. <add name="Test" type="OnlineUsersHTTPModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=78aac1459052cd0a" preCondition="integratedMode" />. it must be the full assembly name, not just the class name. –  Jalali Shakib Mar 21 '12 at 14:13
    
If you have found the solution, please post this as an answer so that other users can find it. Thanks. –  SPDoctor Apr 2 '12 at 12:16

1 Answer 1

up vote 0 down vote accepted

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" />
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.