Is there any alternative to System.Web.Security.Membership.GeneratePassword in AspNetCore (netcoreapp1.0).
The easiest way would be to just use a Guid.NewGuid().ToString("n") which is long enough to be worthy of a password but it's not fully random.
Here's a class/method, based on the source of
Membership.GeneratePasswordof that works on .NET Core:I've omitted the
do...whileloop over theCrossSiteScriptingValidation.IsDangerousString. You can add that back in yourself if you need it.You use it like this:
Also, make sure you reference
System.Security.Cryptography.Algorithms.