I'm using this for connection to SQL Server 2005 [Windows authentication]
<add key="ConnectionString" value="Data Source=MALIK\sqlexpress;Initial Catalog=gainpeace;Integrated Security=SSPI"></add>
but it generates an error
Cannot open database "gainpeace" requested by the login. The login failed. Login failed for user 'MALIK\ASPNET'.
plz guide me how to resolved this issue开发者_高级运维 ...!
You are using "Windows Authentication" and you have not added the ASPNET service account to your database as a user. Under your database server in SQL Server Management Studio, there is a Security node, and under that there is a "Logins" node. Right-click on "Logins" and choose "New Login". In the dialog that pops up, under "Login name", click the button to "Search" and find the ASPNET user (on computer MALIK). Then click on "User Mappings" on the left and check the box next to your database. Also check the box below for "db_owner" (or less) in order to give your user some privileges.
精彩评论