Possible ways to link existing user table into SQLMembershipProvider?

R

Ryan

Hi all,

I have membership working well and I'm trying to integrate it into a
database that makes heavy use of a pre-existing 'User' table. I'd like
to keep my existing table (I've reduced the fields it holds so that it
does not duplicate the .Net provided ones) as there are a lot of joins
to the table and a few extra columns.

This means I have two sets of user data, the .Net one and my very small
table with a few extra columns and a 'loginname' column to join back to
the .Net one.

I've created a user using the site admin tools in Visual Studio so I
can log in initially but my application does not have any knowledge of
this .Net created user. I'd like to be able to subscribe to an event so
that I can keep the two in sync, but as my app is ASP.Net based I can't
see that working.

Has anyone got a good angle on how to approach this? I could put a
trigger on the .Net tables, but I don't want to touch those and I've
put them in the default 'aspnetdb' database to keep them away from my
code.

Thanks in advance

Ryan
 
M

MikeS

Perhaps inherit from the sql provider and override CreateUser and
whatever else.

Public Class MyMember : Inherits SqlMembershipProvider
Public Overrides Function CreateUser(ByVal username As String,...
' Do SQL crud
Return MyBase.CreateUser(...)
End Function

<membership defaultProvider="MyMemberHandler">
<providers>
<add name="MyMemberHandler" type="MyMember"
connectionStringName="LocalSqlServer" ...
 
R

Ryan

Great idea, thanks!

Got a problem now where 1 out of 2 login attempts yields an empty
HTTPContext.Current.User. Same with normal SQLMembership. I'll let you
know if I get find out.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top