Deriving from MembershipUser and ASPNET Config Tool

M

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
 
L

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
 
M

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
 
M

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
 
L

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
 
M

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
 
L

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
 
L

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top