How to change user account properties by ASP.NET?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default How to change user account properties by ASP.NET?

    Hi ALL.

    I have the configuration:
    1. WinXP PRO with MS IIS 5.0 and installed ASP.NET
    2. ASP.NET application A configured to authenticate only users from
    local Users group.

    I would like to de the following:
    Logged on user is able through ASP.NET-Pages to change its own Logon
    Username, Password and Full Name

    I tried to implement it by the code (C#):

    DirectoryEntry deCurrUser = new DirectoryEntry("WinNT://" +
    User.Identity.Name);
    deCurrUser.Invoke("SetPassword", new string[]{"123"} ); // ***

    If the logged on user belongs only to Users group then the statement ***
    causes Exception "SystemUnautherizedException: General access denied error".
    But as soon as that user has been included into Administrators group the
    statement *** is executed well.

    I know about impersonation possibility, but it requires to type clear
    Administrators username and password in code-behind class that will be
    published on target server.

    So, what should I do in order to give to user the ability to change its
    username, password and full name?
    May be orginize on the target server a group, add the users into the group
    and gain to this group some specils rights?

    Thanx
    Evgeny


    Evgeny Zoldin Guest

  2. Similar Questions and Discussions

    1. user account
      I am on log on screen window and want to switch back to welcome to user window.
    2. Change Properties Of Field Through ASP !
      Dear Friends Hope you all doing great. I have this databse uploaded to a server. I want to know is there any way I can change the property of a...
    3. User Account for asp app
      Hello everybody, I have a asp.net application and a setup application for that. How can i configure the setup project to install my asp.net...
    4. change account name does not change login name
      If I try to change an account name through control panel- usermanagement, it appears to be cosmetic only. When I restart, if I attempt to login in...
    5. Old Windows user account VS New windows user account ROUND 1
      Larissa; Her name is listed because her name was used when the profile was created. Create a new profile and copy the data to the new profile:...
  3. #2

    Default Re: How to change user account properties by ASP.NET?

    Hi Evgeny:
    >I know about impersonation possibility, but it requires to type clear
    >Administrators username and password in code-behind class that will be
    >published on target server.
    If you use
    <identity impersonate="true"/>
    in the web.config file, than you are impersonating the client without
    using an explicit username / password. This is probably the safest
    approach, because only local admins would be able to change the
    passwords for the local users.

    You can put username and password attributes in the <indentity>
    element and have the password encrypted in the registry. This is
    described in the remarks section of the following:
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfidentitysection.asp[/url]

    Note however, that all users will then have a request impersonating an
    admin, so it's a dangerous approach.

    --
    Scott
    [url]http://www.OdeToCode.com/blogs/scott/[/url]
    Scott Allen Guest

  4. #3

    Default Re: How to change user account properties by ASP.NET?

    Normally, a user can only call ChangePassword on themselves, not
    ResetPassword. Administrators generally have rights to ResetPassword. The
    latter doesn't require knowing the old password, the former does.

    I think that will solve it.

    Joe K.

    "Evgeny Zoldin" <zoldin@hotmail.com> wrote in message
    news:OeW$%23Ca0EHA.1256@TK2MSFTNGP10.phx.gbl...
    > Hi ALL.
    >
    > I have the configuration:
    > 1. WinXP PRO with MS IIS 5.0 and installed ASP.NET
    > 2. ASP.NET application A configured to authenticate only users from
    > local Users group.
    >
    > I would like to de the following:
    > Logged on user is able through ASP.NET-Pages to change its own Logon
    > Username, Password and Full Name
    >
    > I tried to implement it by the code (C#):
    >
    > DirectoryEntry deCurrUser = new DirectoryEntry("WinNT://" +
    > User.Identity.Name);
    > deCurrUser.Invoke("SetPassword", new string[]{"123"} ); // ***
    >
    > If the logged on user belongs only to Users group then the statement ***
    > causes Exception "SystemUnautherizedException: General access denied
    > error".
    > But as soon as that user has been included into Administrators group the
    > statement *** is executed well.
    >
    > I know about impersonation possibility, but it requires to type clear
    > Administrators username and password in code-behind class that will be
    > published on target server.
    >
    > So, what should I do in order to give to user the ability to change its
    > username, password and full name?
    > May be orginize on the target server a group, add the users into the group
    > and gain to this group some specils rights?
    >
    > Thanx
    > Evgeny
    >

    Joe Kaplan \(MVP - ADSI\) Guest

  5. #4

    Default Re: How to change user account properties by ASP.NET?

    Hi Scott,

    thanks a lot for your help. One more question. is it possible to use
    impresonating not for whole application but for selected page of them,
    namely that where user will be change its data under imparsonated Admin
    account?

    Thank you in advance

    Evgeny

    "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    news:9ra7q0t3440us63d0vce8pje4n0tl6igk1@4ax.com...
    > Hi Evgeny:
    >
    >>I know about impersonation possibility, but it requires to type clear
    >>Administrators username and password in code-behind class that will be
    >>published on target server.
    >
    > If you use
    > <identity impersonate="true"/>
    > in the web.config file, than you are impersonating the client without
    > using an explicit username / password. This is probably the safest
    > approach, because only local admins would be able to change the
    > passwords for the local users.
    >
    > You can put username and password attributes in the <indentity>
    > element and have the password encrypted in the registry. This is
    > described in the remarks section of the following:
    > [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfidentitysection.asp[/url]
    >
    > Note however, that all users will then have a request impersonating an
    > admin, so it's a dangerous approach.
    >
    > --
    > Scott
    > [url]http://www.OdeToCode.com/blogs/scott/[/url]

    Evgeny Zoldin Guest

  6. #5

    Default Re: How to change user account properties by ASP.NET?

    Hi Joe,

    thank you for your advice, but how can I get oldPassword of currently logged
    User in ASP.NET for feed ChangePassword method?

    Evgeny

    "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
    in message news:%23q46FZa0EHA.2228@TK2MSFTNGP15.phx.gbl...
    > Normally, a user can only call ChangePassword on themselves, not
    > ResetPassword. Administrators generally have rights to ResetPassword.
    > The latter doesn't require knowing the old password, the former does.
    >
    > I think that will solve it.
    >
    > Joe K.
    >
    > "Evgeny Zoldin" <zoldin@hotmail.com> wrote in message
    > news:OeW$%23Ca0EHA.1256@TK2MSFTNGP10.phx.gbl...
    >> Hi ALL.
    >>
    >> I have the configuration:
    >> 1. WinXP PRO with MS IIS 5.0 and installed ASP.NET
    >> 2. ASP.NET application A configured to authenticate only users from
    >> local Users group.
    >>
    >> I would like to de the following:
    >> Logged on user is able through ASP.NET-Pages to change its own Logon
    >> Username, Password and Full Name
    >>
    >> I tried to implement it by the code (C#):
    >>
    >> DirectoryEntry deCurrUser = new DirectoryEntry("WinNT://" +
    >> User.Identity.Name);
    >> deCurrUser.Invoke("SetPassword", new string[]{"123"} ); // ***
    >>
    >> If the logged on user belongs only to Users group then the statement ***
    >> causes Exception "SystemUnautherizedException: General access denied
    >> error".
    >> But as soon as that user has been included into Administrators group the
    >> statement *** is executed well.
    >>
    >> I know about impersonation possibility, but it requires to type clear
    >> Administrators username and password in code-behind class that will be
    >> published on target server.
    >>
    >> So, what should I do in order to give to user the ability to change its
    >> username, password and full name?
    >> May be orginize on the target server a group, add the users into the
    >> group and gain to this group some specils rights?
    >>
    >> Thanx
    >> Evgeny
    >>
    >
    >

    Evgeny Zoldin Guest

  7. #6

    Default Re: How to change user account properties by ASP.NET?

    You would have to ask them for it unless you are using Basic authentication,
    in which case you can just read the auth_password header. Most password
    change processes prompt the user to enter the old password as well as the
    new one to verify that the current user actually knows the old one, so I
    don't think users will be too bothered by this.

    Joe K.

    "Evgeny Zoldin" <zoldin@hotmail.com> wrote in message
    news:eGY5mza0EHA.2040@tk2msftngp13.phx.gbl...
    > Hi Joe,
    >
    > thank you for your advice, but how can I get oldPassword of currently
    > logged User in ASP.NET for feed ChangePassword method?
    >
    > Evgeny
    >
    > "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
    > in message news:%23q46FZa0EHA.2228@TK2MSFTNGP15.phx.gbl...
    >> Normally, a user can only call ChangePassword on themselves, not
    >> ResetPassword. Administrators generally have rights to ResetPassword.
    >> The latter doesn't require knowing the old password, the former does.
    >>
    >> I think that will solve it.
    >>
    >> Joe K.
    >>
    >> "Evgeny Zoldin" <zoldin@hotmail.com> wrote in message
    >> news:OeW$%23Ca0EHA.1256@TK2MSFTNGP10.phx.gbl...
    >>> Hi ALL.
    >>>
    >>> I have the configuration:
    >>> 1. WinXP PRO with MS IIS 5.0 and installed ASP.NET
    >>> 2. ASP.NET application A configured to authenticate only users from
    >>> local Users group.
    >>>
    >>> I would like to de the following:
    >>> Logged on user is able through ASP.NET-Pages to change its own Logon
    >>> Username, Password and Full Name
    >>>
    >>> I tried to implement it by the code (C#):
    >>>
    >>> DirectoryEntry deCurrUser = new DirectoryEntry("WinNT://" +
    >>> User.Identity.Name);
    >>> deCurrUser.Invoke("SetPassword", new string[]{"123"} ); // ***
    >>>
    >>> If the logged on user belongs only to Users group then the statement ***
    >>> causes Exception "SystemUnautherizedException: General access denied
    >>> error".
    >>> But as soon as that user has been included into Administrators group the
    >>> statement *** is executed well.
    >>>
    >>> I know about impersonation possibility, but it requires to type clear
    >>> Administrators username and password in code-behind class that will be
    >>> published on target server.
    >>>
    >>> So, what should I do in order to give to user the ability to change its
    >>> username, password and full name?
    >>> May be orginize on the target server a group, add the users into the
    >>> group and gain to this group some specils rights?
    >>>
    >>> Thanx
    >>> Evgeny
    >>>
    >>
    >>
    >
    >

    Joe Kaplan \(MVP - ADSI\) Guest

  8. #7

    Default Re: How to change user account properties by ASP.NET?

    Yes, Evgeny. One way to do this is with a <location> entry.
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrflocationelement.asp[/url]

    --
    Scott
    [url]http://www.OdeToCode.com/blogs/scott/[/url]

    On Tue, 23 Nov 2004 23:37:31 +0100, "Evgeny Zoldin"
    <zoldin@hotmail.com> wrote:
    >Hi Scott,
    >
    >thanks a lot for your help. One more question. is it possible to use
    >impresonating not for whole application but for selected page of them,
    >namely that where user will be change its data under imparsonated Admin
    >account?
    >
    >Thank you in advance
    >
    >Evgeny
    >
    Scott Allen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139