c# - Custom Vs Builtin Authentication Asp.Net And Asp.Net MVC -
i going build web application 1 in mvc , other in webforms . confused whether should use built authentication system available in asp.net , mvc or should go creating custom of own . creating own account controller encrypted password saving etc
i need know use built-in or not if not things need consider encrypted passwords etc should keep in mind while creating own controller .
you can use asp.net identity 2 in both mvc , webform, steep learning curve.
you can read asp.net identity adam freeman's book free.
if think asp.net identity 2 much, can use formauthentiation.
fyi: highly suggest not implement own encryption algorithm. creating encryption algorithm requires lot of skills , testing.
password hash algorithm used asp.net universal providers
private static string generatesalt() { byte[] numarray = new byte[16]; (new rngcryptoserviceprovider()).getbytes(numarray); string base64string = convert.tobase64string(numarray); return base64string; } private string encodepassword(string pass, int passwordformat, string salt) { byte[] numarray; byte[] numarray1; string base64string; bool length = passwordformat != 0; if (length) { byte[] bytes = encoding.unicode.getbytes(pass); byte[] numarray2 = convert.frombase64string(salt); byte[] numarray3 = null; hashalgorithm hashalgorithm = hashalgorithm.create("sha1"); if (hashalgorithm keyedhashalgorithm == null) { numarray1 = new byte[(int) numarray2.length + (int) bytes.length]; buffer.blockcopy(numarray2, 0, numarray1, 0, (int) numarray2.length); buffer.blockcopy(bytes, 0, numarray1, (int) numarray2.length, (int) bytes.length); numarray3 = hashalgorithm.computehash(numarray1); } else { keyedhashalgorithm keyedhashalgorithm = (keyedhashalgorithm) hashalgorithm; if (keyedhashalgorithm.key.length != numarray2.length) { if (keyedhashalgorithm.key.length >= (int) numarray2.length) { numarray = new byte[(int) keyedhashalgorithm.key.length]; int num = 0; while (true) { length = num < (int) numarray.length; if (!length) { break; } int num1 = math.min((int) numarray2.length, (int) numarray.length - num); buffer.blockcopy(numarray2, 0, numarray, num, num1); num = num + num1; } keyedhashalgorithm.key = numarray; } else { numarray = new byte[(int) keyedhashalgorithm.key.length]; buffer.blockcopy(numarray2, 0, numarray, 0, (int) numarray.length); keyedhashalgorithm.key = numarray; } } else { keyedhashalgorithm.key = numarray2; } numarray3 = keyedhashalgorithm.computehash(bytes); } base64string = convert.tobase64string(numarray3); } else { base64string = pass; } return base64string; }
Comments
Post a Comment