I am trying to mock up a custom membership provider to our in house database. I've created the class, login page, etc... I am getting the following error: Could not load type 'iPMNMembershipProvider'.
It might be something to do with my folder structure, but I've been moving things around and can't figure it out.
So as a root level folder I have CustomMembershipProviderTest. In that folder I have an App_Code folder that contains my class iPMNMembershipProvider.vb.
At the root level of the site (same level as CustomMembershipProvider, not within that folder) I have a web.config file that contains the following:
Edit: Forgot to add the code from the beginning of my class file:
Public Class iPMNMembershipProvider
Inherits MembershipProvider
Private conn As String
Public Overrides Sub Initialize(ByVal name As String, ByVal config As System.Collections.Specialized.NameValueCollection)
Should the App_Code file be within the CustomMembershipProviderTest folder or outside at the root level?
Craig Wardman
App_code folder is normally in the website root. However using the app_code folder is only necessary when using the old style 'web site' instead of a 'web project'
Confirm that u are not using the folder within a web project as I have noticed that files in the app_code folder aren't compiled unless u manually change to 'compile' instead of 'content' on the files properties.
If all is ok, generally speaking ur folder structure has no impact on the namespace of your class (unless u keep the naming conventions the same, which is recommeded as good practice)
flukester
ASKER
Okay, I'm just not getting this, I apologize.
I tried using the same path that I use for uploads, but that doesn't work. When you say fully qualified, does that mean drive letter:/folder1/folder2/......
From the examples I see it's namespace, class, but I don't know what my first namespace is. This is on our dev server. I am attaching a screen shot of the class view.
there should be no paths involved, so you dont need to worry about the location on disk..
looking at your class view, its directly in the root.. but your website must have a root namespace, even if its the assembly name..
go into a codebehind file and type 'global. '
see what namespaces are offered to you by intellisense and keep using intellisense on the correct namespaces to find 'iPMNMembershipProvider' - when you find it, use that in your web.config.
flukester
ASKER
The website is an website that has been added to for many years, it wasn't started as an asp.net website. We have just added asp.net applications to it. When I type global. I get right to the iPMNMembershipProvider namespace. See attached. Untitled-1.jpg
Craig Wardman
Hmm, in your web config can u use global.iPNM.... With any success?
U might need to precompile the class into a dll to get this to work. Put it in a class library and then add a reference to the project in ur website. By doing this it will generate a proper assembly, namespace and classname for the type.
Namespace YourApplicationNameSpacePublic Class iPMNMembershipProvider Inherits MembershipProvider Private conn As String Public Overrides Sub Initialize(ByVal name As String, ByVal config As System.Collections.Specialized.NameValueCollection) conn = ConfigurationManager.ConnectionStrings("web_ipmnConnectionString").ConnectionString MyBase.Initialize(conn, config) End SubEnd ClassEnd Namespace