Pergunta

1) I want to know suppose we are using an ASP.NET web application in debug mode in VS, then, the code runs under which user account?

2) I also want to know, suppose we publish this to the IIS and then, set it up to use WBA/FBA, then, the username/password of logged in user is used to authenticate user to the ASP.NET site, however, the code (SQL query, etc) runs under credentials of apppool account. Further, which credential is used to access resources on server like files? What is your view on this point?

Foi útil?

Solução

1) I want to know suppose we are using an ASP.NET web application in debug mode in VS, then, the code runs under which user account?

This is depending on the hosting. VS provides 4 ways to host & debug a web application : VS Dev Server (VS 2012), IIS Express, Local IIS and Custom Host (VS 2013). Devs servers generally runs under your -Administrator- account, and may not be suitable to test security. Working directly with IIS as your development web server lets you work in an environment closer to that of an IIS production web server.

This is configured in the Web Tab in your web project properties. enter image description here

2) I also want to know, suppose we publish this to the IIS and then, set it up to use WBA/FBA, then, the username/password of logged in user is used to authenticate user to the ASP.NET site, however, the code runs under credentials of apppool account. What is your view on this point?

Not very clear, but I think your undestanding of IIS security may not be correct. There is only one application pool per web site which runs under a specific account (by default apppool account, but it could be Network Service or Local System). When a user logs in, absolutely nothing is changed in this process. The user is just connected using an authentication provider : Windows Authentatication or Forms Authentication are 2 common providers. User identity is kept in http context, which allow you to use authorization rules later. So every code block always run under the same account (unless you enable delegation but that's another story).

I higly suggest you to read this complete introduction on asp.net security.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top