Hashed or Encrypted passwords are not supported with auto-generated keys

后端 未结 2 466
执念已碎
执念已碎 2021-02-08 02:38

I have create a Membership provider and changed my web.config to


   
     

        
2条回答
  •  悲&欢浪女
    2021-02-08 03:38

    Was a bit of a schlep to go hunting for the "key generator" snippet in the MSDN link Steven Robbins referred to in his answer, so I am adding it here for quick reference. So this is not a standalone answer. It is supplemental to the accepted answer.

    FROM MSDN

    The following code shows how to generate random key values. Compile the code to create a console application, and then pass the required key size as a command line argument expressed as the desired number of hexadecimal characters. Each byte is represented by two hexadecimal characters; therefore, to request a 32-byte key, pass 64 as a command line argument. If you do not specify an argument, the code returns a 128 hexadecimal character (64-byte) key.

    using System;
    using System.Text;
    using System.Security;
    using System.Security.Cryptography;
    
    class App {
      static void Main(string[] argv) {
        int len = 128;
        if (argv.Length > 0)
          len = int.Parse(argv[0]);
        byte[] buff = new byte[len/2];
        RNGCryptoServiceProvider rng = new 
                                RNGCryptoServiceProvider();
        rng.GetBytes(buff);
        StringBuilder sb = new StringBuilder(len);
        for (int i=0; i

    Also, goes inside of , like this:

    
        
    

提交回复
热议问题