Error with windows impersonation code in webconfig file

后端 未结 2 852
梦如初夏
梦如初夏 2021-01-22 01:25

I have the following section declared in the webconfig file to allow impersonation , I have shared the folder to public access within the network on the other machine

         


        
相关标签:
2条回答
  • 2021-01-22 01:45

    I can't tell, because you have rightfully blocked out the username, but if you're not fully declaring the username with the domain name, then it will fail with this error.

    Are you using the domain name?

    <identity impersonate="true" userName="domain\user" password="password" />
    

    Everything else about your setup seems correct.

    Your domain name could either be the name of the domain you are connected to, or the name of your PC. An easy way to find out is to open the command window and type:

    echo %userdomain%
    
    0 讨论(0)
  • 2021-01-22 01:59

    This is what I did to solve this issue. I hope it will help someone.

    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="Domain\user" password="password" />

    0 讨论(0)
提交回复
热议问题