Home All Groups Group Topic Archive Search About

Deriving from MembershipUser and ASPNET Config Tool

Author
13 Jan 2006 3:12 PM
Mark Olbert
I'm reposting this in case it got lost...

The ASPNET Configuration tool does not appear to be able to handle derived MembershipUser classes.

Even the simplest possible derived class (one which merely wraps MembershipUser itself, duplicates its public constructor but adds
no additional methods or properties) causes ASPNET Configuration to blow up. The error message indicates that ASPNET Configuration
cannot load the derived Type from the website's dynamically-created assembly (i.e., the derived MembershipUser class is in the
site's AppCode folder).

The same problem occurs if the derived MembershipUser class is housed in a class library referenced by the site.

Have others run into this problem? Better yet, have others created derived MembershipUser classes which operate with the ASPNET
Configuration tool?

- Mark

Author
16 Jan 2006 8:26 AM
Luke Zhang [MSFT]
Hello Mark,

In ASPNET Configuration, ew can create and manage user with form
authentication. However, I am not very clear about what you want this tool
to  handle derived MembershipUser classes. Can you explain more on this and
provide a reproducable sample on this issue, including the source code of
the class inherits from MembershipUser and how you use it in a project?

Regards,

Luke
Are all your drivers up to date? click for free checkup

Author
16 Jan 2006 4:14 PM
Mark Olbert
Luke,

To reproduce the problem, take a custom MembershipProvider and modify CreateUser() to return a custom MembershipUser object. The
derived MembershipUser class doesn't even need to implement any new functionality; you can just make it a "wrapper" around the base
MembershipUser class, duplicating the public constructor.

Register the provider in the web.config file, and then run the ASPNET Configuration tool for the site. Try to create a new user. On
my system, it throws an exception (which the Configuration tool captures, but which stops it from processing).

What I want to be able to do is use a derived MembershipUser class to "store" extended user information. I don't expect the ASPNET
Configuration tool to display that information, or let me edit it. I just want to be able to create users with the Configuration
tool and a custom MembershipUser class.

- Mark
Author
17 Jan 2006 7:49 AM
Luke Zhang [MSFT]
Hello Mark,

You may check the web.config file to see if your provider has been set to
defaultProvider, and if its type name is correct.

Here is a sample provider, you may first test it on your system to see if
it can work:

http://www.devx.com/asp/Article/29256?type=kbSampleProd&trk=MSCP

Luke
Author
17 Jan 2006 3:45 PM
Mark Olbert
Luke,

My custom MembershipProvider is properly registered and accessible from the website application. That's not the problem.

Can you please confirm for me whether or not derived MembershipUser classes actually work with the ASPNET Configuration tool?

- Mark
Author
18 Jan 2006 7:28 AM
Luke Zhang [MSFT]
Yes, I can confirm. Below is sample which can have
"AccessMembershipProvider" display in the configration tool:

        <membership defaultProvider="AccessMembershipProvider" >
            <providers>
                <remove name="AspNetSqlMembershipProvider" />
                <add name="AccessMembershipProvider" type="AccessMembershipProvider"
requiresQuestionAndAnswer="true"    connectionStringName="AccConn"    />
            </providers>
        </membership>

        <roleManager defaultProvider="AccessMembershipProvider">

            <providers>

                <add name="AccessMembershipProvider"
type="System.Web.Security.AccessRoleProvider, System.Web,
Version=1.1.3300.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="AccConn"   />

            </providers>

        </roleManager>


One thing needs to be mentioned is that we also need a role Provider here.

Hope this help,

Luke
Author
18 Jan 2006 3:12 PM
Mark Olbert
I know you need to define a custom MembershipProvider. I've done that! It works great!

What doesn't work is a custom MembershipUser class returned by a custom MembershipProvider. That's what I'd like to know if it's
possible.

- Mark
Author
19 Jan 2006 3:24 AM
Luke Zhang [MSFT]
The problem may be related to the provider you create. Can you send me your
test project to me? I may study it to see if I can find anything wrong. (To
get my actual email, please remove 'online' )

Luke Zhang
Author
19 Jan 2006 5:24 AM
Mark Olbert
Luke,

I just sent you an email. Please let me know when you get it.

- Mark
Author
20 Jan 2006 7:59 AM
Luke Zhang [MSFT]
Hello,

I have received the project. I haven't find a "web.config" in it. This is
very important in this issue, could you please send me a copy used by your
web project?

Luke

Bookmark and Share