skip to Main Content

i am trying to implement impersonation in a project. this is the first time i am trying it
this is what i have done.

 <identity impersonate="true" userName="NS1name" password="secret" />

i am using the username and password provided as the plesk credantials.

I don’t know if my username format is correct.

These are the details.

Windows 2003 shared server

IIS6

provider name : space2host

thanks in advance

Update:this is the error i get

Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.

5

Answers


  1. What is “Plesk credentials”? Are they the ones used to log in to Plesk? If yes, I think they do not necessary correspond to the account on the machine with the web server.

    Login or Signup to reply.
  2. face the similar issue yesterday, what you need to do is to ensure the user account you want to impersonate already exist in your debugging machine.

    Login or Signup to reply.
  3. I believe the answer to your question is in the error message: the account you are using does not exist or you supplied an incorrect password.

    The question being where the user does not exist. If you are using <authentication mode="Windows"/> in Web.config (which I guess you are) it would mean that your Active Directory (the domain controller for your domain (NS1)) or your Windows-box (if NS1 is the name of your (devel or server) machine) does not know the user. Actually I am unsure how (if?) impersonation works with something else than AD/Windows.

    Btw: your format is correct. UserName like <domain><username> and a (valid) password in “password”.

    More information can as often be found on the Microsoft website.

    Login or Signup to reply.
  4. I had a similar problem. This is the answer I posted here : Error with windows impersonation code in webconfig file

    I’m running Windows 8.1 and IIS 7 and I had the same message as the author.

    These are the steps I followed to solve the issue :

    1) If not already set in Windows, set the password for the account to make it match with the information there is in the web.config file

    Go to PC settings -> Accounts -> Sign In option and set your password

    2) Add Windows authentication in IIS Windows feature

    a) Right click on the Windows logo in the bottom left corner

    b) Click ‘Control panel’

    c) Click ‘Programs’

    d) Click ‘Turn Windows features on or off’

    e) Under ‘Internet Information Services’ -> ‘World Wide Web Services’ -> ‘Security’, check ‘Windows Authentication’

    3) Restart the computer

    4) In IIS Manager, in the ‘IIS’ group, click on ‘Authentication’

    5) Make sure the status of ‘ASP.Net Impersonation’ and ‘Windows Authentication’ are Enabled

    6) Restart the computer and re-run the solution

    Also make sure that your web.config impersonate line contains the Domain like this :

    <identity impersonate="true" userName="Domainuser" password="password" />

    Login or Signup to reply.
  5. Adding the “complained” user to the IIS will solve the problem
    Control Panel –> System and Security –> Administrative Tools –> (double click) Computer Management –> (expanse on left side column) Local Users and Groups –> (select) Users –> (right click right side panel and select) New User (remember to choose “Password never expired”)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search