can't override ValidateUser

Posted by Community Admin on 03-Aug-2018 09:59

can't override ValidateUser

All Replies

Posted by Community Admin on 19-Oct-2010 00:00

Hello,

I wanted to override SitefinityMembershipProvider.ValidateUser method but my custom membership provider which inherits SitefinityMembershipProvider doesn't work

I edited this part in web.config
<membership defaultProvider="Default">
    <providers>
      <clear />
      <add name="Default" type="Company.Web.CustomMembershipProvider" />
    </providers>
</membership>

and place my custom membership in App_Code folder.

Thank you for your help!

Regards,
RC

Posted by Community Admin on 19-Oct-2010 00:00

Hi RC,

Thank you for using our services.

Can you please let us know what is the error you are getting? Also please note that App_Code folder does not exist in web application project, which is the Sitefinity 4.0 website. You can add the code anywhere in the project and the assembly name will be SitefinityWebApp. Also make sure that you build the application before running it.

Sincerely yours,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 20-Oct-2010 00:00

Hi Radoslav,

Yes, I only added App_Code folder to house code customizations.
There is no error displayed, its just username and password are not being passed to ValidateMethod of custom membership whenever I logged in to Sitefinity.
Is my implementation correct that I inherit from Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider?

Thanks!

Posted by Community Admin on 20-Oct-2010 00:00

Hi RC,

Thank you for the clarification.

Can you please try the following steps.

1) Revert the web.config to its original value.

2) Make your class inherit from OpenAccessMembershipProvider

3) Login to Sitefinity back-end and go to Administration -> Settings -> Security -> Membership Providers and register your custom membership provider.

4) You should at least specify an applicationName in its parameters collection. For example CustomProvider/

Note that since you are inheriting from the built in provider you can configure the same parameters as in the default ones.

5) Make sure that the Enabled check box is selected for your provider and go to the Users section. From there create a new user in your custom provider and assign it to the administrators role.

6) Log out and on the log in screen select your custom provider from the provider dropdown and try to authenticate with the new user.


All the best,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 21-Oct-2010 00:00

Thanks for the steps Radoslav.


But theres no ValidateUser method in OpenAccessMembershipProvider.
Is SitefinityMembershipProvider the one being hook during Sitefinity backend login?
If so, how can I inherit from it so I can insert further validation inside ValidateUser method?

Thanks much!

Posted by Community Admin on 21-Oct-2010 00:00

Hi RC,

There is such a method which can be overriden. It has two overloads - one taking user name and password, and the second taking user ID and password. Please take a look at the attached sample project. You might need to resolve the broken references before running it.

Sincerely yours,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 21-Oct-2010 00:00

Thank you Radoslav, got it! I missed that OpenAccessMembershipProvider inherits from MembershipDataProvider. :)

This thread is closed