1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / can't override ValidateUser

can't override ValidateUser

7 posts, 2 answered
  1. RC
    RC avatar
    15 posts
    Registered:
    06 Apr 2010
    19 Oct 2010
    Link to this post
    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
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    19 Oct 2010
    Link to this post
    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
  3. rcfausto
    rcfausto avatar
    5 posts
    Registered:
    23 Sep 2010
    20 Oct 2010
    Link to this post
    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!

  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    20 Oct 2010
    Link to this post
    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
    Answered
  5. rcfausto
    rcfausto avatar
    5 posts
    Registered:
    23 Sep 2010
    21 Oct 2010
    Link to this post
    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!

  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    21 Oct 2010
    Link to this post
    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
    Answered
  7. rcfausto
    rcfausto avatar
    5 posts
    Registered:
    23 Sep 2010
    21 Oct 2010
    Link to this post
    Thank you Radoslav, got it! I missed that OpenAccessMembershipProvider inherits from MembershipDataProvider. :)
7 posts, 2 answered