OOP help (in regards to ASP.NET Membership)

M

mazdotnet

Hi all,

I just found out that ASP.NET membership does not have a method to
lock accounts (only Unlock user)
See http://forums.asp.net/p/825946/825946.aspx


Question was 'I understand that the MembershipUser.UnlockUser method
will unlock an account (set the aspnet_Membership IsLockedOut back to
0 so on), but I see no way to Set LockUser. Is there nothing built in
to Membership to do this? '


A user responsed 'No, you have to create your own method that will
lock the user. '. I haven't done much inheritance coding... What's
the
best way of doing this? Do I create a new class that inherits from
Membership? Can you please show me a sample code? I would do it by
creating a class ex. ManageUser and add method 'LockUser' but from my
understanding it's better to extend the current Membership class and
add the new method. If you can sort of map out the main class
structure that would be perfect.


Thx
M.
 
C

Cowboy \(Gregory A. Beamer\)

If you are using the standard implementation, you can inherit from the
provider you are using (most likely SqlMembershipProvider) and simply add
the new lock method. This helps you avoid a complete rewrite from the base
provider.

One thing I do not like about the default provider is you can set up a lock,
but you cannot specify a reason for the lock in the standard tables. There
are probably some reasons that require a higher level of admin to unlock
again.

Write out your provisioning needs before you start coding, as this can bite
you real quick.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 

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

Top