Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8447679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:14:23+00:00 2026-06-10T10:14:23+00:00

All of the examples I’ve found are in C# and I need one if

  • 0

All of the examples I’ve found are in C# and I need one if VB. How can I turn my code below to inherit all of the Membership provider functions?

Imports System.Data.Entity
Imports MyBlog

Namespace MyBlog

    Public Class EmployeeController
        Inherits System.Web.Mvc.Controller

        Private db As EmployeeDbContext = New EmployeeDbContext

        '
        ' GET: /Employee/LogOn

        Public Function LogOn() As ActionResult
            Return View()
        End Function

    End Class

End Namespace

Here are the articles that I’ve read Custom membership or not, Implementing custom login for ASP.NET MVC. I can’t seem to inherit more than one class in VB (don’t often use inheritance or implement or interfaces).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:14:24+00:00Added an answer on June 10, 2026 at 10:14 am

    You need to write a class that inherits from MembershipProvider and override the methods you are interested in:

    Public Class MyCustomMembershipProvider
        Inherits System.Web.Security.MembershipProvider
    
        Public Overrides Property ApplicationName As String
            Get
    
            End Get
            Set(value As String)
    
            End Set
        End Property
    
        Public Overrides Function ChangePassword(username As String, oldPassword As String, newPassword As String) As Boolean
    
        End Function
    
        Public Overrides Function ChangePasswordQuestionAndAnswer(username As String, password As String, newPasswordQuestion As String, newPasswordAnswer As String) As Boolean
    
        End Function
    
        Public Overrides Function CreateUser(username As String, password As String, email As String, passwordQuestion As String, passwordAnswer As String, isApproved As Boolean, providerUserKey As Object, ByRef status As System.Web.Security.MembershipCreateStatus) As System.Web.Security.MembershipUser
    
        End Function
    
        Public Overrides Function DeleteUser(username As String, deleteAllRelatedData As Boolean) As Boolean
    
        End Function
    
        Public Overrides ReadOnly Property EnablePasswordReset As Boolean
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property EnablePasswordRetrieval As Boolean
            Get
    
            End Get
        End Property
    
        Public Overrides Function FindUsersByEmail(emailToMatch As String, pageIndex As Integer, pageSize As Integer, ByRef totalRecords As Integer) As System.Web.Security.MembershipUserCollection
    
        End Function
    
        Public Overrides Function FindUsersByName(usernameToMatch As String, pageIndex As Integer, pageSize As Integer, ByRef totalRecords As Integer) As System.Web.Security.MembershipUserCollection
    
        End Function
    
        Public Overrides Function GetAllUsers(pageIndex As Integer, pageSize As Integer, ByRef totalRecords As Integer) As System.Web.Security.MembershipUserCollection
    
        End Function
    
        Public Overrides Function GetNumberOfUsersOnline() As Integer
    
        End Function
    
        Public Overrides Function GetPassword(username As String, answer As String) As String
    
        End Function
    
        Public Overloads Overrides Function GetUser(providerUserKey As Object, userIsOnline As Boolean) As System.Web.Security.MembershipUser
    
        End Function
    
        Public Overloads Overrides Function GetUser(username As String, userIsOnline As Boolean) As System.Web.Security.MembershipUser
    
        End Function
    
        Public Overrides Function GetUserNameByEmail(email As String) As String
    
        End Function
    
        Public Overrides ReadOnly Property MaxInvalidPasswordAttempts As Integer
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property MinRequiredNonAlphanumericCharacters As Integer
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property MinRequiredPasswordLength As Integer
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property PasswordAttemptWindow As Integer
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property PasswordFormat As System.Web.Security.MembershipPasswordFormat
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property PasswordStrengthRegularExpression As String
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property RequiresQuestionAndAnswer As Boolean
            Get
    
            End Get
        End Property
    
        Public Overrides ReadOnly Property RequiresUniqueEmail As Boolean
            Get
    
            End Get
        End Property
    
        Public Overrides Function ResetPassword(username As String, answer As String) As String
    
        End Function
    
        Public Overrides Function UnlockUser(userName As String) As Boolean
    
        End Function
    
        Public Overrides Sub UpdateUser(user As System.Web.Security.MembershipUser)
    
        End Sub
    
        Public Overrides Function ValidateUser(username As String, password As String) As Boolean
    
        End Function
    End Class
    

    And then you register your custom provider in web.config:

    <membership defaultProvider="MyMembership">
        <providers>
            <clear />
            <add 
                name="MyMembership" 
                type="MvcApplication1.MyCustomMembershipProvider, MvcApplication1" enablePasswordRetrieval="false" 
            />
        </providers>
    </membership>
    

    Now from within your controllers you simply use the Membership class. For example in your LogOn action that was generated by the default template when you created your project you don’t need to change absolutely anything:

    <HttpPost()> _
    Public Function LogOn(ByVal model As LogOnModel, ByVal returnUrl As String) As ActionResult
        If ModelState.IsValid Then
            If Membership.ValidateUser(model.UserName, model.Password) Then
                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe)
                If Url.IsLocalUrl(returnUrl) AndAlso returnUrl.Length > 1 AndAlso returnUrl.StartsWith("/") _
                   AndAlso Not returnUrl.StartsWith("//") AndAlso Not returnUrl.StartsWith("/\\") Then
                    Return Redirect(returnUrl)
                Else
                    Return RedirectToAction("Index", "Home")
                End If
            Else
                ModelState.AddModelError("", "The user name or password provided is incorrect.")
            End If
        End If
    
        ' If we got this far, something failed, redisplay form
        Return View(model)
    End Function
    

    All calls to Membership will now use your custom membership provider that you registered in web.config.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In all examples everybody can find code like this: DataInputStream inputStream = null; try
In all examples I can find as well as the automatically generated code i
I need to redirect from one url to another full url all examples I
Normally in all examples/source code of AngularJS modifications of scope is done in controllers.
I have found that in all examples (include rails documentation) that I have seen
I'm trying to map my Hashmap in Hibernate. All examples I can find are
All examples in Qt show that one should use delegate classes to provide editors
Is it possible to virtualize both horizontally and vertically? All examples show one or
All examples I found was C# related, but I'm unfamiliar with it. My task
send() shall return the number of bytes sent or error code, but all examples

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.