.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Change Password

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Sql Server
Hello, I'm trying to change the password of a user. This is my code: Dim conn As New ServerConnection("STATION01\SQLEXPRESS", wContainer.Username, wContainer.Password) Dim myServer As New Server(conn) Dim myUsername As String = TextBox2.Text.Trim Dim myPassword As String = TextBox3.Text.Trim If myServer.Logins.Contains(myUsername) And myUsername <> String.Empty Then Dim db_login As New Login(myServer, myUsername) db_login.ChangePassword(myPassword) db_login.Alter() End If It doesn't work.

View Complete Post

More Related Resource Links

Password change control won`t accept new password


Hi guys

I am developing a shopping cart with asp.net and sqlexpress. I am using aspnet authentication components to create a backend page. I designed the site to let in only authorized users in. 

Yesterday, I forget my password to login to backend and asked system recover my password. with recover password of the asp.net I was able to receive the temp password. I took that and logged in, of course asp.net forward me to password change component which I am having problem with. 

Every time I change my password , password change shows that I was successfull but after clicking on the continiue button password change component comes back. I went to properties of password change component and entered the main default page as destination but it is not helping. 

I close the IE clear the cache , even restart the machine. When I login always taking me to the password change page.

So, I need your help with this. Please let me know your inputs.


Change password for FBA users in claims setup not working as expected

Hi, I am trying to add a standard asp:changepassword control for external users. In the previous 2007 sharepoint environment this control was working "out of the box". I am pretty sure what is wrong as well,- but not sure how to fix it. A workaround that makes me able to change password is as follows: in the asp - control, I have added the option DisplayUserName="true" Then in the actual web-page, i can see that my username is: 0#.f|acaspnetsqlmembershipprovider|xxxxxx and not xxxxxx as i would excpect, as i use xxxxxx to log in. Editing the username to just xxxxxx makes the changing of password work, but this solution is not really nice to deploy to the normal end-users.. Any suggestion on how to make the username right? I've tried to set the username using the option UserName="<%=SPContext.Current.Web.CurrentUser.LoginName%>", but it does not seem to evaluate..  

change password from the database

I have created login page(login.aspx) using login cotrol, now my lead asked me to provide an option "Change Password" so that end-user can change his password any time.I have created different form named as ChangePassword if you click lable ChangePassword on login.aspx page a pop-up window appears with changepassword control.how can i make this work using same(login) table. i searched around for code around i did not find.I used this link to create login page http://www.vbdotnetheaven.com/UploadFile/raj1979/VBLoginControl07242008114552AM/VBLoginControl.aspx Can any one help me,thanks

Change Password for SP administrator in sharepoint 2010


Dear All,

What is the optimal steps to Change Password for SP administrator in sharepoint 2010 to aviod and problems .


error message customization in create user wizard, change password wizard


Hi All,

Create User Wiard and Change Password Wizard contain error message literals. They display error messages when a user is trying to sign up with an username that already exists and so on.

These error messages are pre-set. How can they be customized. In particular, how can they be adjusted depending on the language.

How is this usually best achieved?

Thanks a lot.


Central Administration not Available, STSADM password reset errors "job-admin-apppool-change" alread


Hi Everyone,

I think I've shot myself in the foot by not properly following set up instructions.

I have a two-fold problem.  Firstly, my Sharepoint Central Administration V4 site is showing Service Not Available.  This seems to be related to the credentials the Central Administration V4 Application Pool - hitting Test Settings within IIS Manager for the site shows an Authentication and Authorization error for the credentials due to a bad password.

My reading indicates that I should run something to the effect of:

%STSADM -o updatefarmcredentials -userlogin DOMAIN\username -password <new password as set via AD>

This runs into the following Error message

Error deploying administration application pool credentials. Another deployment may be active. An object of the type Microsoft.SharePoint.Administration.SPAdminAppPoolCredentialDeploymentJobDefinition named "job-admin-apppool-change" already exists under the parent Microsoft.SharePoint.Administration.SPTimerService named "SPTimerV4".  Rename your object or delete the existing object.


I've tr

Change windows password remotely


Hi all,

Not sure where to post this, so I thought I'd start here...

I am designing a website (ASP.NET in VB) and I'd like it to have the following features: to generate a random string to be used as a password. This bit I should be able to manage, the bit I don't have a clue on is how I can pass this to a Windows machine (on a workgroup not AD) to change a user's account password.

In summary, can anyone help me to remotely change a user's password on a Windows workgroup machine using ASP.NET with VB?

FYI, I have full administrator access.

Thanks in advance for any help you can provide.
Jim :-)

How to use Asp.net Change password Control in Sharepoint

Hi Team ,

 i have used ADLDS for forum  authentication in sharepoint site .  i want use Asp.net Change password  web Control  for change user password . How to use in sharepoint . 

 i am followed ADLS Config step based below URL .   the user can login in sharepoint site . but the user want change their password using  ASP.net  Change password  web Control  . 

with regards

Change Password for Windows Authentication


Hello all,

I do not seem to be able to find even a yes no answer on this...

Using windows Authentication... is it possible to progrematically change a password?


I tried using several ways to do this. I tried using the ChangePassword  control. This tells me that minimun characters is 7 even though I have more then 7 characters... I also tried using this method:

            if (u.ChangePassword(TextBox2.Text, TextBox3.Text))
                LabelError.Text = "Password changed.";
                LabelError.Text = "Password change failed. Please re-enter your values and try again.";
        catch (Exception ex)
            LabelError.Text = "An exception occurred: " + Server.HtmlEncode(ex.Message) + "<BE>" + ex.ToString() + ". Please re-enter your values and try again.";


The user is always null... and I am assuming this is because this object is indended to use with Forms authentication.


All I want to do is have an option for users to change passwords. Is this possible with Windows Authentication?

Change UserName and Password Requirements



 How do i change the default user name and password requirements.   I wanna make the user name the person email address and i don't want it case sensitive.. I wanna make the mininum password to be 4 characters or numbers case sensitive.  The maxinum password can be 10 characters or numbers.



Change domain AD + upgrade Sharepoint 2007->2010 = window with a request login/password


New installation of Sharepoint 2010 in Domain_A domain. I added a content database WSS_content2007 from Sharepoint 2007 (from domain Domain_B). I didn't run the command stsadm -migrateuser. New accounts from domain Domain_A were manually added to SharePoint 2010. In table Userinfo on WSS_Content2007 on Sharepoint 2010 are accounts from both domains. Old domain Domain_B was deleted.
Users get a window with a request re-enter your username and password from time to time.
What should I do? Can I delete the account from the domain Domain_B with stsadm command? Should the column tp_title contain unique records for the same user and the same site?


Getting System.Reflection.TargetInvocationException while trying to change the AD password of an use



I'm having this problem and I'm not able to solve this for a while now. The scenario is like any user of my web apps can change their application password and the corresponding Server AD ID password from the application itself. I'm using .NET 3.5 framework and was came to know that by using the namespace called

System.DirectoryServices.AccountManagement  we can do any AD ID manupulation by writing C# code. I've written the below code to change the AD password of the user.

#region SetUserDomainPassword for setting the new password as domain password

private bool SetUserDomainPassword(string strUserId, string strNewPassword)


bool blnflag = false;



UserPrincipal oUserPrincipal = GetUser(strUserId);


blnflag = true;

return blnflag;



catch (Exception ex)


ExceptionPolicy.HandleException(ex, "EPolicy");

return blnflag;




#region GetUser for getting the user info

public UserPrincipal GetUser(string sUserName)


PrincipalContext oPrincipalContext = GetPrincipalContext();

UserPrincipal oUserPrincipal =

UserPrincipal.FindByIdentity(oPrincipalContext, sUserName);

Getting System.Reflection.TargetInvocationException while trying to change the AD password from GUI



I'm having this problem and I'm not able to solve this for a while now. The scenario is like any user of my web apps can change their application password and the corresponding Server AD ID password from the application itself. I'm using .NET 3.5 framework and was came to know that by using the namespace called

System.DirectoryServices.AccountManagement  we can do any AD ID manupulation by writing C# code. I've written the below code to change the AD password of the user.



SetUserDomainPassword for setting the new password as domain password


private bool SetUserDomainPassword(st

why can't I change my sa password?


 have SQL Server 2008 Developer edition

I can log into it as Windows Authentication as me no problem.

I need to change my sa password so that another application can log in on this. I log in using my windows authentication as me and change the sa password. It does not give any errors. I try to log in as sa using sql server authentication and I get error 18456.

I tred running the following script:

exec sp_password @new = 'test1234', @loginame = 'sa' which executed fine but again I get error 18456 when I try to log in.

I set up a new user with a password and the setup went through OK. I tried to log in as this user - still error 18456.


I am not a sql expert but I cannot see what I am doing wrong.

My user name is mapped to master, model, msdb and tempdb but my default schema against each of these says dbo. Is this wrong?

Alternatively can anyone tell me how to discover what my existing sa password is????

Thanks in advance


Roy T

How to Change password of Active Directory user in ASP.net (c#)



 I have written code in asp.net on button Click


DirectorySearcher mySearcher = new DirectorySearcher(_entry);


SearchResult searchResult = mySearcher.FindOne();


DirectoryEntry objDirectoryEntry = searchResult.GetDirectoryEntry();


if (searchResult != null)



"ChangePassword", new object[] { "OldPassword", "NewPassword1234" });



 I am getting error

Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) active Directory

please help me how to resolve this error.



AD/FBA Password Change Web Part for Sharepoint 2010


Is anyone aware of a working web part to change passwords for AD or FBA users for Sharepoint 2010.  I've found several that work with WSS 3.0 but nothing out there for 2010 yet.  Anyone have some insight? 



Resetting user Password and setting User Must Change Password at next Logon with ASPX


Hi All,

I am having an issue with an asp.net project that I am doing and have been struggling with it for a while now and was hoping someone here might be able to help me out.

Basically what we are doing is resetting peoples passwords via a web page. I have got it to the point that it is resetting the users password but is not setting User Must Change Password at Next Logon in AD. Just so that I can save you time asking the lstOffice.Text in the Connection String is so that our Admin can select the office that the users profile is present in on the AD. 

The code is shown below (connection strings and users/passwords have been changed):

 Sub SetPassword()

        Dim de As New DirectoryEntry("LDAP://IP:389/ou=Layer1" + ", " + "ou =" + lstOffice.Text + ", " + "ou=Layer3,DC=1,DC=2,DC=com,DC=au")
        'authent for AD 
        de.AuthenticationType = AuthenticationTypes.Secure
        de.Username = "ADMIN"
        de.Password = "NotTh3realpassword"

            ' new directory searcher
            Dim ds As New DirectorySearcher(de)

            Dim mySearchResultColl As SearchResultCollection

            Dim mySearchResult As SearchResult
            '  ds.Filter = ("sAMAccountname = " + name)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend