Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 31, 2013 01:36 AM by Chen Yu - MSFT
Jan 30, 2013 06:14 AM|LINK
maybe, I am wrong, but I am trying get only passwordFormat (nothing else) from web.confing to my created CustomMembershipProvider nothing happen
public override void Initialize(string name, NameValueCollection config)
string passwordformat = config["passwordFormat"];
pPasswordFormat = MembershipPasswordFormat.Hashed;
pPasswordFormat = MembershipPasswordFormat.Encrypted;
pPasswordFormat = MembershipPasswordFormat.Clear;
throw new ProviderException("Password format not supported.");
Configuration cfg = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey");
if (PasswordFormat != MembershipPasswordFormat.Clear)
throw new ProviderException("Hashed or Encrypted passwords are not supported with auto-generated keys.");
and part of web.config
<membership defaultProvider = "CustomMembershipProvider">
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\Documents and Settings\KrzysztofSzymaniak\Moje dokumenty\szymon.mdb';"
I have written simple code to insert user to database, but password is inserting as plaintext, not encrypt. Why?
What should I do for get value from web.config?
Jan 30, 2013 06:57 PM|LINK
I solved problem. I apologize for incomprehensible post. I forgot write that I created own form for register new user
Below is code (in button register event) which works ok.
CustomMembershipProvider cmp = (CustomMembershipProvider)Membership.Providers["CustomMembershipProvider"];
cmp.nowyuzyt(textBox1.Text, textBox2.Text, textBox3.Text, dropDownList1.SelectedItem.Text, out s, out h);
Jan 31, 2013 01:36 AM|LINK
Thank you for sharing your solutions and experience here. It will be very beneficial for other community members who have similar questions.