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 6995933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:05:35+00:00 2026-05-27T20:05:35+00:00

Is there a Membership.ValidateUser alternative that only checks username password combo? In other words,

  • 0

Is there a Membership.ValidateUser alternative that only checks username password combo? In other words, is there a way I can tell that the username and password are correct but the user is not valid? It may come handy when implementing confirmation email for registrations.

  • 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-05-27T20:05:36+00:00Added an answer on May 27, 2026 at 8:05 pm

    Yes,

    simply do a lookup in the user datastore.

    eg.

    public static string IsUserValid(string username, string password)
    {
        if(!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
        {
    
             var allIsGood = true;
             // query user datastore for username and password
             // change allIsGood to true or false based on result
    
             return allIsGood;
        }
    
        return false;
    }
    

    EDIT:

    for the encrypted password I use and MD5 Hash. so this helper class might be helpful

    #region Usings
    
    using System.Security.Cryptography;
    using System.Text;
    
    #endregion
    
    namespace Shared.Tools
    {
    public static class Crypto
    {
        public static string CalculateMd5Hash(string input)
        {
            // step 1, calculate MD5 hash from input
            var md5 = System.Security.Cryptography.MD5.Create();
            var inputBytes = Encoding.ASCII.GetBytes(input);
            var hash = md5.ComputeHash(inputBytes);
    
            // step 2, convert byte array to hex string
            var sb = new StringBuilder();
            for (var i = 0; i < hash.Length; i++)
            {
                sb.Append(hash[i].ToString("x2"));
            }
            return sb.ToString();
        }
    
        public static string GetHashValue(this MD5 hash, string value)
        {
            return GetHashValue(hash, Encoding.UTF8.GetBytes(value));
        }
    
        public static string GetHashValue(this MD5 hash, byte[] value)
        {
            var data = hash.ComputeHash(value);
            var md5 = "";
            for (var i = 0; i < data.Length; i++)
            {
                md5 += data[i].ToString("x2").ToLowerInvariant();
            }
    
            return md5;
        }
    
        public static string MD5(this string value)
        {
            var algorithm =
                System.Security.Cryptography.MD5.Create();
    
            var data = Encoding.ASCII.GetBytes(value);
            data = algorithm.ComputeHash(data);
            var md5 = "";
            for (var i = 0; i < data.Length; i++)
            {
                md5 += data[i].ToString("x2").ToLower();
            }
    
            return md5;
        }
    }
    }
    

    and you might do something like this for your test method

    public static string IsUserValid(string username, string password)
    {
        // using Linq to Entities/Sql
        return  YourDataContext
                .Users
                .Where(u => u.UserName == username
                         && u.Password == password.MD5)
                .FirstOrDefault() != null;
    }
    

    I haven’t compiled or tested this but it should give you the gist of what you are after.

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

Sidebar

Related Questions

Is there a way to use the same username and password from the membership
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
is there any custom asp.net membership providers that someone has already created online. I
Q1 A) Is there a way to create membership database ( using aspnet_regsql tool
Is there a way to make ChangePassword control work without Membership provider? Like the
I'm using the ASP.NET SQL Membership Provider. So, there's an aspnet_Users table that has
Is there a way I could use custom membership provider without need to create
I've been learning about the MembershipProvider class and I thought that the Membership.ValidateUser() method
So I have implemented my own custom membership provider, currently only overwriting ValidateUser(). I
Is there a way to obtain a specific membership provider? When you make calls

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.