Click here to Skip to main content
15,946,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi sir,


I need to
Connecting to SQL Server using windows authentication in vb.net


i got the error like this

Cannot open database "FTS" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.


What I have tried:

<connectionStrings>

<add name="ConnectionString" connectionString="Data Source=.\sentil;Initial Catalog=FTS;Integrated Security=True;Encrypt=False" providerName="System.Data.SqlClient;Max Pool Size=200" />

</connectionStrings>
Posted

1 solution

Basically, it's a bad idea to use WA in a website - which is where the IIS APPPOOL\DefaultAppPool bit is coming from.
Because IIS runs under a "generic user" rather than a specific, logged in, "real-world" user, that is the ID that you are trying to connect to your DB using - and if it worked (and it looks like the DB admin hasn't enabled it) then that user would have to have significant DB privileges, which is a very poor idea in a web-based setting. Think about it: if you set up a DB user and log in as them, you can give that user just the permissions he requires to do the job: Read only perhaps, or maybe add Update and / or Insert - but no row delete, or no table delete. That means that any hacks that try to damage your DB can be mitigated because the only user they can access doesn't have permissions to do that!

Use a proper SQL User and things get safer, and easier to manage.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900