I am new to user asp.net's membership and user features. I was able to create users and roles for my website by doing the following:
1. Adding the following lines to my web.config file:
<roleManager enabled="true" />
<authentication mode="Forms" />
2. Adding users and roles using the ASP.Net Web Site Administration Tool (Visual Web Developer 2008 Express >> Website Menu >> ASP.Net Configuration)
3. Creating a Login.aspx page with a Login control.
However, with the current system I was using I didn't know how to change the parameters for the membership providers, such as setting requiresQuestionAndAnswer="false".
After searching for help on this topic, I tried adding the following code to my Web.Config file:
1. When I went back into ASP.Net Web Site Administration Tool, the roles I had created were still there, but the users were gone.
2. I created new users using the ASP.Net Web Site Administration Tool, but when I try to login using my Login.aspx page, the new users are not recognized, but the old users are.
Why are my new users not being recognized? Why were my old users deleted according to the ASP.Net Web Site Administration Tool but recognized on my web server?
It is probably worth noting that I have my Visual Web Developer 2008 Express project saved on my location machine and then I move files to my web server using Website >> Copy Website from within Visual Web Developer Express.
You should also specify which provider should be used by your Role manager and Membership manager. Also, replace APPLICATION_NAME with the name of your application so that the users and roles are specific to this application:
bwol
Member
4 Points
34 Posts
Modifying Membership Parameters when Using Default Provider
May 04, 2009 08:25 PM|LINK
Hi,
I am new to user asp.net's membership and user features. I was able to create users and roles for my website by doing the following:
1. Adding the following lines to my web.config file:
2. Adding users and roles using the ASP.Net Web Site Administration Tool (Visual Web Developer 2008 Express >> Website Menu >> ASP.Net Configuration)
3. Creating a Login.aspx page with a Login control.
However, with the current system I was using I didn't know how to change the parameters for the membership providers, such as setting requiresQuestionAndAnswer="false".
After searching for help on this topic, I tried adding the following code to my Web.Config file:
Adding that code caused several things to happen:
1. When I went back into ASP.Net Web Site Administration Tool, the roles I had created were still there, but the users were gone.
2. I created new users using the ASP.Net Web Site Administration Tool, but when I try to login using my Login.aspx page, the new users are not recognized, but the old users are.
Why are my new users not being recognized? Why were my old users deleted according to the ASP.Net Web Site Administration Tool but recognized on my web server?
It is probably worth noting that I have my Visual Web Developer 2008 Express project saved on my location machine and then I move files to my web server using Website >> Copy Website from within Visual Web Developer Express.
Any suggestions are much appreciated,
Bryan
bullpit
All-Star
21838 Points
4822 Posts
Re: Modifying Membership Parameters when Using Default Provider
May 04, 2009 08:46 PM|LINK
You should also specify which provider should be used by your Role manager and Membership manager. Also, replace APPLICATION_NAME with the name of your application so that the users and roles are specific to this application:
<roleManager enabled="true" cacheRolesInCookie="false" defaultProvider="AspNetSqlMembershipProvider" cookieName=".ASPXROLES" cookiePath="/" cookieTimeout="999" cookieRequireSSL="false" cookieSlidingExpiration="true" createPersistentCookie="false" cookieProtection="All"> <providers> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" applicationName="/APPLICATION_NAME"/> </providers> </roleManager> <membership userIsOnlineTimeWindow="15"> <providers> <remove name="AspNetSqlMembershipProvider"/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/APPLICATION_NAME" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="10000" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> </providers> </membership>Max
Let Me Google That For You!
guru_sarkar
All-Star
22198 Points
3463 Posts
Re: Modifying Membership Parameters when Using Default Provider
May 04, 2009 08:49 PM|LINK
one key attribute you should add to your membership provider is applicationName.
also it is good to specify defaultProvider...
It could be anything ... but here I have used "/"
After this modification....create new users and roles and try.
bwol
Member
4 Points
34 Posts
Re: Modifying Membership Parameters when Using Default Provider
May 04, 2009 10:20 PM|LINK
Thanks bullpit, I pasted your code into my Web.Config file, added my application name and it's working now.
Smadhu
Member
511 Points
998 Posts
Re: Modifying Membership Parameters when Using Default Provider
May 02, 2012 06:34 AM|LINK
i also want to modify as i want to use to providers in webconfig
n how do i use different membership provider for diffrent pages
Guys PLz do help me
thnx