When a user tries to connect to a SQL Server Database through Windows Authentication in my ASP MVC 3 app, with the following connection string:
<add name="btnintranetContext" connectionString="Data Source=BTN-SERVER;Initial Catalog=Intranet;Integrated Security=SSPI;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/>
They get the following error:
Cannot open database "Intranet" requested by the login. The login failed.
Login failed for user 'User'.
I understand what this means, it means that I haven't given that user access to the database, but I want user's to be able to access the database without having to give them all access to it. I've tried specifying a specific Database user in my connection string like so:
<add name="btnintranetContext" connectionString="Data Source=BTN-SERVER;Initial Catalog=Intranet;User Id=mylogin;Password=mypassword;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/>
But I get a new error:
Login failed for user 'mylogin'.
The provider did not return a ProviderManifestToken string.
But I know for definite that mylogin has access to the database because when I try to access the database with the windows authentication connection string, it works. But for security reasons, I don't want to give everyone that uses my app access to the database, thats why I tried specifying a user in the connection string.
Additional info from my web.config file:
<authentication mode="Windows" />
<identity impersonate="true" />
<trust level="Full"/>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>