473,831 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

membership reset password in asp.net

1 New Member
I am using membership control in my webapplication.

On reseting password, i want control should generate password such that i can define the length of the password.

Please help on this.
May 1 '10 #1
5 5325
Frinavale
9,735 Recognized Expert Moderator Expert
Um?
I'm not sure what you're having problems with.
Have you seen this article on the MembershipUser. GeneratePasswor d Method?

-Frinny
May 3 '10 #2
planecrash
3 New Member
Did you read the guys question? He wants to know how to specify the length of the password that MembershipUser. ResetPassword() generates. For example, when I use this method, the # of characters in the password generated is 14. I, however, am aiming to keep this length to a single digit integer, for reasons I won't get into.

Click on the link to the MSDN article you provided. Once there, press "Ctrl + F" and start typing "leng" and you will notice that word doesn't appear anywhere on the page.

I've often wondered, if you don't have a direct solution to somebody's question, why post anything at all?
Jun 2 '10 #3
planecrash
3 New Member
@rajnikantrana
The answer to the mans question, in C#, however, is this...
Expand|Select|Wrap|Line Numbers
  1. //Get the user in question
  2. var u = Membership.GetUser(userName, false);
  3.  
  4. //Reset password to a temporary value
  5. var tempPword = u.ResetPassword();
  6.  
  7. //Call the GeneratePassword method that accepts a parameter for length
  8. var newPword = Membership.GeneratePassword(9, 0);
  9.  
  10. //Change the users password from the temp value to the new one
  11. u.ChangePassword(tempPword, newPword);
Jun 2 '10 #4
Frinavale
9,735 Recognized Expert Moderator Expert
I did read the OP's question and it still doesn't make any sense. There are several possible topics the OP could be having problems with and so I sent them to a generic helpful site on the topic with the hopes that they would post back here with more details and/or clarification on the problem they are facing.

If you want to know how to specify the length of the password that should be provided:
  • Open the web.config file
  • Go to the providers section under the membership section
  • Set the minRequiredPass wordLength attribute to the length you desire
  • If you wish you could also set the other attributes here...like the minRequiredNona lphanumericChar acters attribute.

Code example:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2.  <system.web>
  3.   <membership>
  4.    <providers>
  5.     <clear/>
  6.     <add name="AspNetSqlMembershipProvider"
  7.      type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
  8.      connectionStringName="LocalSqlServer" 
  9.      requiresQuestionAndAnswer="false" 
  10.      requiresUniqueEmail="true" 
  11.      passwordFormat="Hashed" 
  12.      minRequiredNonalphanumericCharacters="0" 
  13.      minRequiredPasswordLength="3"/>
  14.    </providers>
  15.   </membership>
  16.  
  17.   </system.web>
  18. </configuration>
Happy coding,

-Frinny
Jun 2 '10 #5
planecrash
3 New Member
@Frinavale
Specifying a minimum password length, in the web.config, DOES NOT specify the length of the result from ResetPassword, it only specifies the result will be at least that length. For example, I have this value set to 6, in a current project, but ResetPassword returns a result of length 14. The OPs was very plainly asking, "how do I generate a password x characters in length". Your last reply just confuses the issue.
Jun 2 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2177
by: Paul Keegstra | last post by:
Hi, I am currently working on an asp.net 2.0 web site that is a replacement of a classic asp web site. The current web site uses a Commerce Server 2002 database for storing user information. It does not currently use any of the Commerce Server 2002 functionality with the exception of the user authentication features. I have written my replacement application to use a custom login form and custom connection string so that I can use...
0
4030
by: lanem | last post by:
I am using the asp.net 2.0 membership stuff. How do I reset a user's password? I don't want to use the password recovery thing to email it to them. I just want to do it as an admin like I would set up their account or delete their account. Is there an easy tool somewhere in the configuration stuff somewhere?
1
1217
by: John | last post by:
Hi I have looked in help but am not clear how to do the following in vb.net code. 1. Check if a user belongs to a specific role. 2. Change user's password. Is it possible to do it without knowing the old/existing password?
1
1453
by: Lukas Kurka | last post by:
Hi, I want to create user (admin) that will be able to reset other users passwords stored in Membership database. As far as I found out, there is method ResetPassword but you have to know answer for password restore question... I just want to have user, who will be able to reset passwords for everybody without knowing answer and question. How should I do this? Lukas
1
1391
by: Josh | last post by:
I'm having trouble resetting a password using these new fangled membership classes, can anyone tell me whats wrong with this sample? The membership user is being correctly returned. But I get a null error. MembershipUser mu = Membership.GetUser(userName); string newPassword = Membership.GeneratePassword(12, 1); mu.ChangePassword(mu.ResetPassword(), newPassword);
1
1690
by: xpnctoc | last post by:
Hello, Has anyone ever experienced data corruption when using the .NET 2.0 Membership API security framework and SQL Server 2000? I wrote a web app for a client that has 300 users. Most of the users are fine, but a handful are complaining that they use their account for a week or two and then "all of a sudden" their password is not valid anymore. They also claim that when they try to use the password reset utility after their password...
1
1569
by: xpnctoc | last post by:
A while ago I posted a message regarding an ASP.NET (.NET 2.0) webstie I am working on for a client, which utilizes the Membership API. The problem was that a seemingly random contingent of the 400+ users are having password change/reset problems. Apparently the users change their passwords, and then after a period of time their login magically stops working. The obvious answer is that the users making typos. Since I was using asymmetric...
1
2730
by: jobs | last post by:
I'm using asp.net Membership security. Using the Password recovery control, users can reset/recover their passwords. Great. I've grid with all the users. I'd like to add a button so the admin of the ap can reset anybodies password (sending them a new password). Is there class that will do this? If not, any way around this? Thanks for any help or information!
0
1190
by: drjack | last post by:
Recently I developed a website using asp.net and SQL Express. The database file is uploaded into App_Data folder. The website is using two membership providers, one is SqlMemership provider with default name AspNet…. With such configuration: <membership> <providers> <clear/> <add connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"...
2
20651
by: rmgalante | last post by:
I am using the standard asp.net membership provider. I have users who forget their password. They attempt to login 5 times and they get locked out. The membership configuration in web.config follows. <add connectionStringName="SomeDB" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="SomeApp" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5"...
0
9794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10778
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10496
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10538
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.