Modifying Membership Parameters when Using Default Provider

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:

 

<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:

 
     <membership/>
<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"
requiresUniqueEmail="false" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="1" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>

 
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

0
bwol
5/4/2009 8:25:56 PM
asp.net.security 27051 articles. 1 followers. Follow

3 Replies
1165 Views

Similar Articles

[PageSpeed] 17
Get it on Google Play
Get it on Apple App Store

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>
 
Thanks,
Max
Let Me Google That For You!
0
bullpit
5/4/2009 8:46:31 PM

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 "/"

<membership defaultProvider="AspNetSqlMembershipProvider">
      <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"
                  requiresUniqueEmail="false" minRequiredPasswordLength="5"
                  minRequiredNonalphanumericCharacters="1" passwordFormat="Hashed"
                  maxInvalidPasswordAttempts="5"
                  passwordAttemptWindow="10" passwordStrengthRegularExpression=""

                  applicationName="/"

 />
      </providers>
    </membership>

After this modification....create new users and roles and try.


/GuruBhai
0
guru_sarkar
5/4/2009 8:49:01 PM

 Thanks bullpit, I pasted your code into my Web.Config file, added my application name and it's working now.

0
bwol
5/4/2009 10:20:34 PM
Reply:

Similar Artilces:

Using of Membership Provider-s out of APS.NET
I would like to use the membership Privider out of ASP.NET. For this reason I have referenced the System.web.dll from one Console-Application. However, by calling any of methods on MembershipProvider the exception is thrown indicating that the provider is not properly initialized. This is reasonable, because no any initializations have been performed.   For example: the same provider has been configured in some other ASP.NET application as SqlMembership provider. All settings are stored in the web.config file.   My question is how to configure the same provider in some no...

Providing Web Services using the built-in membership and security
As a part of my application, I want to provide a secure WebServices, using the built-in login & security process but I do not how to achieve it. My ASP application uses the aspnet database together with membership and profile to allow users to login to the site. I also developed a small windows application for offline transaction processing. I want to be able to upload these transactions to the main database (to my ASP application). I can use the web service but it does not have any security at all. I want users to use the same usernames and passwords as in the main application to ...

Using Default Membership Provider with Sql Server(not SqlExpress)
Recently I decided to build one of these customers website on asp.net 2.0 after I found the hosting company I always work with, now is supporting version 2. I used the default membership provider using the SQLExpress on my local, though the other database stuff was on Sql Server 2000. After uploading the site, I found the error which says the Sql Server 2005 do not allows remote connections, and I discovered that the host doesnt support sqlexpress, so I ran aspnet_regsql tool on my main database and changed all connection strings to reffer it. I changed the LocalSqlServer connection string a...

How to use the PasswordStrength Control with the CreateNewUser Wizard in the Default Membership Provider?
I am having trouble getting the PasswordStrength control to work with the CreateNewUserWizard.  The control works fine when it refers to a new textbox, e.g. txtTest1, that I just place on a page however when I reffer to the textbox "Password" in the CreateNewUserWizard the control does not work. The Extender needs to be in the same naming container scope as the control it's extending.  So in the CreateNewUserWizard, convert the name/pwd page to a template and stick the password strength control next to the Password textbox.Don't forget, this posting is provided "AS IS&q...

which is shou i use? Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NET
Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NETI am confused?Which is better or which one should I use?BTW, I am going to use .net 2.0 with oracle 9. Can anyone tell me what shou I use for working with oracle database?Thanks very much in advance!Justin Oracle's data provider has more functionality than Microsoft's.If your doing transaction processing you can have SAVEPOINTs, which Microsoft's data provider does not provide.Also, Oracle has PL/SQL Associative Arrays which are very powerful.Oracle also allows you to bind parameters by name and pos...

Membership provider disabling security question answer and modifying the password format
I am including the membership provide to my application and I really don't have a use for security answer and question as well as my password doesn't have to so secured I don't need to have non alphabetical characters in my password. Can I control the above functionalities. When I am creating users I want to exclude these features.  Can anyone shed some light on how to modify these controls. Thank you  Hi, you need to modify the web.config membership provider attributes make password format = "Clear" requiresQuestionAndAnswer="fals...

Can I get the password or password answer using default membership provider?
My issue is: In my application, password is hashed with SHA1 using js on client-side before it is send to server, than membership will create a user using hashed format of password, it works perfect on creating user and login. But when user resets password, I cannot use the default method SqlMembershipProvider provides, I have to randomly generate a new password, hash it with SHA1 and update the MembershipUser. Up to now I can solve this problem using GeneratePassword method to get a new password, hash it, and use ChangePassword method to update user, however it is quite resource-consumin...

How to get new web app to use .NET 2.0 on Win2K server using .NET 1.1 as default framework?
I have .net framework1.1 and 2.0 on our server running win2K. i have existing applications that uses asp.net 1.1, i also have a new app that use ASP.net 2.0.  how can i set my new .NET 2.0 app to point to asp.net 2.0 without messing up my existing .NET 1.1 apps? To specify the ASP .Net version fro a web application, do the followingIn IIS Manager select the web application -> Properties -> ASP.Net TabSelect  ASP.Net version you want to use for the applicationRegards,PrashantDont forget to click "Mark as Answer" on the post that helped you. But I am running Win2K...

System.Security.SecurityException when using login control with custom membership provider on shared hosting
I have an application for which I have written a  custom membership provider.The implementation is similar to http://msdn.microsoft.com/en-us/library/6tc47t75.aspx with just a simple user table and having the basic create user and login functionality.The application works fine when I use it on localhost, but gives the following exception when I host it on GoDaddy:    Security Exception Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission...

Matching the Default Role Provider to the Membership Provider?
I have a website where I am planning on programatically switching the membership provider that is used for the logon controls based on which client accesses the website. Each client organization will have has their membership/role/application data in a seperate SQL 2000 DB. Once the user is sucessfully logged in, they will be granted access to or denied access to certian pages based on the roles associated with their user ID. I have been able to configure the necessary membership provider definitions in the Web.config file and I can change the provider assignment in the login controls using ...

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

How to remove Security Question and Security Answer from membership provider?
How to remove Security Question and Security Answer from membership provider?Following is my codes. Please tell me how to remove Question and Answer from membership provider. Thank you for replying.CreateNewWizard.aspx            <asp:CreateUserWizard ID="CreateUserWizard1" runat="server">                <WizardSteps>                    &l...

Using SQLmembership Provider OR Creating Custom membership Provider
Hi Friends!I have started building my first professional project(actually a web portal). that is kind of business project. I need full membership features. now what you think? If SqlMembership Povider in asp.net is enough for a professional application or not? should i create a custom membership provider?which one is better. How about security?you know in real systems for example we need many informations not exists in Create User Wizard Web Control in asp.net(like address,...)and there is some ways to add these costom infos to the wizard or ASPNETDB database file and I think this causes cha...

does the order of adding parameters matter when using parameters in .net
string sql = "update mytable set nameField = :nameparm where keyField = :keyparam"; updateCMD.CommandText = sql; with the above update statment the following order of adding parameters doesn't work in .NET 2.0 updateCMD.Parameters.Add(keyparm); updateCMD.Parameters.Add(nameparm); while the following works updateCMD.Parameters.Add(nameparm); updateCMD.Parameters.Add(keyparm); why does index of Parametercollection matters when it is going to be matched by name parameter? what will happen in the following scenario. "update mytable set ...

Web resources about - Modifying Membership Parameters when Using Default Provider - asp.net.security

Polish European Union membership referendum, 2003 - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Drivers of Facebook Shuttle Buses Eye Teamsters Membership
Facebook and several other tech companies in Silicon Valley provide shuttle buses to transport their employees, and according to The New York ...

NJ Membership (@NJMembership) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Membership Has Its Privileges
Right now, crossing one of the magical rep borders happens more or less unnoticed. People just gain the particular powers. Now, of course they ...

Membership Cards - a set on Flickr
... home Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Membership ...

Calgary Public Library: New Look. New Library. Free Membership. - YouTube
CREATING THE WORLD’S BEST PUBLIC LIBRARY: NEW LOOK. NEW LIBRARY. FREE MEMBERSHIP. For Immediate Release: In a bold move to become the world’s ...

The benefits of private club membership in the UAE
Lifestyle membership clubs can offer cardholders exclusive leisure discounts across the Emirates. But there can be a big catch - you need to ...

New Brisbane Broncos CEO Paul White Flags Membership Drive
The coal executive taking over at the helm of the Brisbane Broncos has his eyes set on the thousands of fans who regularly turn up to home games ...

Joe Tripodi's ALP membership suspended
NSW ALP has suspended membership of Joe Tripodi amid a corruption inquiry.

Invite-only memberships expand at Canberra's sky-high lounge
... club &ndash; if they have been lucky enough to get an invite The 15th floor lounge billed as Canberra's most exclusive has quadrupled its membership ...

Resources last updated: 12/1/2015 4:23:21 PM