Which account is used when a user navigates to a ASP.NET website?

和自甴很熟 提交于 2019-12-11 15:43:11

问题


When a user browses to a ASP.NET website, is the user impersonating the ASPNET account or the account specified in IIS->Directory Security->Account used for anonymous access (EX: IUSR_XXX)

My website writes files to the disk and I was wondering which of these accounts need write access to the folder? Also, can someone explain how the impersonate element in the web.config ties into all this?

Thanks!


回答1:


If impersonation is enabled in an ASP.NET application then:

  • If anonymous access is enabled in IIS, the request is made using the IUSR_machinename account.
  • If anonymous access is disabled in IIS, the request is made using the account of the authenticated user.
  • In either case, permissions for the account are checked in the Windows Access Control List (ACL) for the resource(s) that a user requests, and a resource is only available if the account they are running under is valid for that resource.

If impersonation is disabled in an ASP.NET application then:

  • If anonymous access is enabled in IIS, the request is made using the system-level process account.
  • If anonymous access is disabled in IIS, the request is made using the account of the authenticated user.
  • In either case, permissions for the account are checked in the Windows ACL for the resource(s) that a user requests, and a resource is only available if the account they are
    running under is valid for that resource.

Source: Understanding Impersonation in ASP.NET




回答2:


By default the identity is MachineName\ASPNET, you can change this behavior by turning on identity impersonation in the web.config



来源:https://stackoverflow.com/questions/1981578/which-account-is-used-when-a-user-navigates-to-a-asp-net-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!