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

Published Sunday, July 13, 2008 1:01 AM by anas
Filed under:

Comments

# re: Differences when Registering Httpmodules and HttpHandlers for Web application Projects and webSite project

Wednesday, May 28, 2008 2:54 AM by aneesxpert

Very helpfull. Great effort.

# re: Differences when Registering Httpmodules and HttpHandlers for Web application Projects and webSite project

Sunday, June 15, 2008 9:59 AM by rizwan328

good article

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

Tuesday, July 15, 2008 2:58 AM by Shahaji

Nice Stuff

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

Tuesday, August 26, 2008 10:32 PM by MorningZ

Thank you so much for this post..... very helpful

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

Tuesday, November 04, 2008 10:08 AM by mahmoud

so nice ..

very helpful

regards

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

Thursday, January 15, 2009 2:32 PM by Jereme Guenther

Great post.  I did notice that there seems to be a couple of format variations on how the 'type' is allowed to be specified.

In particular for an application it is allowed to specify the .dll with a comma after the namespace.

# difference between web application and website « Dot Net Solutions

Pingback from  difference between web application and website « Dot Net Solutions

Leave a Comment

(required) 
(required) 
(optional)
(required)