views:

52

answers:

1

My associate has created a custom SessionStateProvider for me to use with my ASP.net application. I add the file CustomSessionStateProvider to my VS2008 Web Application Project and put the appropriate reference in the web.config and it works fine.

However, my supervisor wants me to set this up as a GAC reference. At my office, we have many DLLs we've created that we use as GAC references across different projects.

If I add my CustomSessionStateProvider to the Global Assembly Cache, my pages throw a could not load type CustomASP.CustomSessionStateProvider error. Simple removing the DLL from the GAC makes it work again, but I want to set this up as a GAC reference.

What could be causing this problem?

+2  A: 

You need to change your web.config to include the fully qualified name of your class. It would look something like this:

CustomASP.CustomSessionStateProvider, CustomASP, Culture=neutral, PublicKeyToken=XXXXX 

This assumes that the assembly is called "CustomASP" and that the class is in a namespace also called "CustomASP" and that the class name is "CustomSessionStateProvider". Furthermore, as you probably already know, your assembly needs to be signed to be in the GAC. Therefore you should change XXXX to the public key token of the key you use for signing.

Hope it helps.

klausbyskov