Friday, March 16, 2012

Membership - adding methods (programming help)

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.On Sep 12, 5:18 pm, mazdotnet <maflat...@.gmail.comwrote:

Quote:

Originally Posted by

Hi all,
>
I just found out that ASP.NET membership does not have a method to
lock accounts (only Unlock user)
Seehttp://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.


Hello:
In case you're using Sql server as repository, the best way to achieve
this is to extend SqlMembership, wich is the class that manage users.
Once you add your method to the new class, you shoul add it to your
system.web provider section in
Webconfig file.

<membership defaultProvider="CustomizedProvider">
<providers>
<add name="CustomizedProvider"
type="MyNamespace.MyMembershipProvider" connectionStringName="ConStr"
applicationName="AppName" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false" enablePasswordReset="true"
enablePasswordRetrieval="false"/>
</providers>
</membership>

Best regards
Oscar Acosta
On Sep 13, 5:43 am, Cubaman <oscar.acostamonte...@.googlemail.com>
wrote:

Quote:

Originally Posted by

On Sep 12, 5:18 pm, mazdotnet <maflat...@.gmail.comwrote:
>
>
>
>
>

Quote:

Originally Posted by

Hi all,


>

Quote:

Originally Posted by

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


>

Quote:

Originally Posted by

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? '


>

Quote:

Originally Posted by

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.


>

Quote:

Originally Posted by

Thx
M.


>
Hello:
In case you're using Sql server as repository, the best way to achieve
this is to extend SqlMembership, wich is the class that manage users.
Once you add your method to the new class, you shoul add it to your
system.web provider section in
Webconfig file.
>
<membership defaultProvider="CustomizedProvider">
<providers>
<add name="CustomizedProvider"
type="MyNamespace.MyMembershipProvider" connectionStringName="ConStr"
applicationName="AppName" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false" enablePasswordReset="true"
enablePasswordRetrieval="false"/>
</providers>
</membership>
>
Best regards
Oscar Acosta- Hide quoted text -
>
- Show quoted text -


Thank you
M.

0 comments:

Post a Comment