Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET Membership - questions
    text
    copied!<p>I would like to ask something regarding membership in .NET. I am getting some problems when I try to use membership. I followed the rules as per given by microsoft site. Just done some settings in Web.config as follows</p> <pre><code>&lt;membership&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MyConnectionString" minRequiredNonalphanumericCharacters="3" requiresUniqueEmail="false" maxInvalidPasswordAttempts="3" requiresQuestionAndAnswer="false" enablePasswordRetrieval="false" enablePasswordReset="true" minRequiredPasswordLength="7" applicationName="/"/&gt; &lt;/providers&gt; &lt;/membership&gt; </code></pre> <p>Then I have used <code>CreateUser</code> method of membership. All the parameters to call the method are fine but sometimes it returns status as <code>InvalidPassword</code>. I do not know why it is returning the status but sometimes it is creating user successfully. Can somebody please explain me where I am wrong? This is function I am using:</p> <pre><code> MembershipUser newUser = Membership.CreateUser(ObjModel.FirstName, ObjModel.password, ObjModel.Email, null, null, true, out status); //ObjModel.FirstName + ObjModel.LastName, ObjModel.LastName, ObjModel.password,ObjModel.Email ,null, null, true, out status); Message = status.ToString(); if (status == MembershipCreateStatus.Success) { MembershipUserId = new Guid(Membership.GetUser(ObjModel.FirstName).ProviderUserKey.ToString()); Roles.AddUserToRole(ObjModel.FirstName + ObjModel.LastName, "Client"); } </code></pre> <p>Lastly one more question: after I receive success message I want to add this user to role and role would be client. How should I use it? I have not created Roles. when should one create roles? we can create roles independently of the other tables? and what If I have to create one more membership user and but it's role should be admin and so on?Actually what should be the proper flow of creating users, creating roles and adding user roles programmatically? what is application Id in the sql membership tables? Please clear all my doubts . I have searched and tried googling but yet there are some points that are not getting cleared. Please help ASAP.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload