Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Could not load type" error trying to install HTTPModule on IIS6 - Web.config error

Two hours of searching Google and Stackoverflow and I've gotten nowhere. This is not related to code-behind, which is why I've had no luck so far.

Here's my problem: I have a legacy website running IIS6 and I need to install an HTTPModule on it to add some processing to any request for a specific file type. I've written the module, copied it over to the application's /bin directory, and added the following to my Web.config:

<system.web>
  <httpModules>
    <add name="YourModule" type="SecurityModule.SecurityModule" />
  </httpModules>
</system.web>

Then I fire up the website and... "Server Error in /MyApplication".

Here is the entirety of what it gives me:


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load type 'SecurityModule.SecurityModule'. (D:\Websites\Reports\web.config line 4)

Source Error:

Line 2:     <system.web>
Line 3:       <httpModules>
-->Line 4:            <add name="YourModule" type="SecurityModule.SecurityModule" />
Line 5:       </httpModules>
Line 6:     </system.web>

Source File: D:\Websites\Reports\web.config Line: 4

Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3618


Line 4, where I added an arrow, is red. And that's it! No explanation, no hints on where to go. Just "Could not load type". I have tried all sorts of things to get around this:

  • Played with the name of the module in case I got it wrong. And the string in the type.
  • Changed /Bin to /bin
  • Make sure the module was compiled against the .NET Framework 2.0
  • Abandoned web.config and tried setting it up as a mapping in IIS 6 (got 404s from that one).
  • Related to previous, tried making all files of my extension go through the ASP.NET ISAPI module with a wildcard mapping and configuring the module. Brought me full circle back to this error.

Can anyone tell me what's going on here? Or, failing that, can someone point me in a direction? At this point, any direction will do. :) I'm at a complete dead end.

Thanks!

like image 994
Ari Roth Avatar asked May 13 '13 23:05

Ari Roth


1 Answers

You should use an assembly qualified name.

NamespaceQualifiedTypeName, AssemblyName
like image 151
ChaosPandion Avatar answered Nov 15 '22 05:11

ChaosPandion