I am trying to write a simple Gui to produce a random password.
The code I am trying to use is:
using System.Web.Security;
Password_txtBx.Text = Membership.GeneratePassword(12, 1);
I am getting the error: “The name ‘Membership’ does not exist in the current context”
I have changed the code to this:
Password_txtBx.Text = System.Web.Security.Membership.GeneratePassword(12, 1);
The error message I get then is: “The type or namespace ‘SecurityMembership’ does not exist in the namespace ‘System.Web’ (are you missing an assembly reference?)”
I have referenced System.Web.Security in both examples above. Is there any way to fix my problem?
Add a reference to System.Web (References -> RightClick -> AddReference -> .NET – > System.Web)
Now add a using (or Imports if using VB) for System.Web.Security
You may need to change Profile to .Net (instead of .Net Client Profile)