Differences between Web Application Project(WAP) and website Projects when specifying the Type settings attribute

When configuring a custom providers , or registering HttpHandlers and HttpModules , or using any other configurations sections that needs to specify the type settings attribute , you will need to correctly specify the type by specifying a correct  Namespace and Assembly .

Its not the same for web application projects (WAP) and website projects , i will discuss this difference by providing an example on how to register the httpModule .

If you are not familiar with HttpModules and HttpHandlers , please read this

Also if you are not familiar with the Differences between WAP and website project , Please read this and this 

Now , lets talk about the Difference :

For WebSite project :

when you are writing a custom HttpModule  in App_Code folder that is inside your website,Then you can register the Custom module in web.config in this format:
 

so for example if you write this module in App_Code


Then you can register that module in web.config as follows:


 For Web application Projects (WAP) :

Now,when you are working with web application Project ( or VS 2003 web application ),

Then you need to PrePrend the WebApplication Name(Actually the Root NameSpace of the Project)   before the HttpModule Class Name as follows:



When The module Or Handler Written in a separate Class Library:

when you need to register a custom HttpModule  that is written in a separate class library , then you need to use the following format :


 

In this Blog post i mentioned the correct way to specify the Type attribute when working with  Web application Project, Website project, and  Custom class library project.

Finally , if you didn't specified that correctly , you will get this exception :

 "Could not load file or assembly  or one of its dependencies "...


Hope that Helps

Anas Ghanem

5 Comments

Comments have been disabled for this content.