Windows user on IIS

Asked

Viewed 902 times

2

I’m trying to log in to a base SQL Server 2008, with the windows user who is accessing my site published on IIS.

I’ve already set up Web.Config for windows authentication, set up the application pool leaving the identificador equal AplicationPoolIdentity.

When accessing the site I can catch the correct user by the command WindowsIdentity.GetCurrent(). But when trying to connect in the database is returning the following error Login failed for user 'dominio\desenvolvedor1$'. and developer 1 is name of my machine and not the user that is in windows.

To Connection string is Data Source=vc9;Initial Catalog=sgt;Integrated Security=SSPI;Application Name='Controle de Sprint';Pooling=False;

If the user logs directly into the database via right Sql Management as well, by the windows user.

Follows as configured the IIS access permissions

inserir a descrição da imagem aqui

1 answer

1

According to the configuration you put in the question it seems that you missed setting "impersonate=true" on your web.config.

Place the following code snippet.

<configuration>
  <system.web>
    <identity impersonate="true"/>
  </system.web>
</configuration>

"impersonate=true" is the bridge for the ISS to use the authenticated user account in accessing external resources (SQL, File System, etc...)

See more details on: https://msdn.microsoft.com/pt-br/library/xh507fc5(v=vs.100). aspx

NOTE: Make sure that giving SQL access to user logins is ideal in your solution. With this type of permission, a user who knows the database address can access it directly (via SQL Management Studio).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.