You are here : Home » knowledge exchange
System.Data.SqlClient.SqlException: Cannot open database " smg " requested by the login. The login failed. Login failed for user 'C02\ASPNET'. a. Solution: The resolution for this, is as follow:-1. Create a Domain Account with priveleges similar to ASPNET or NETWORKSERVICE.2. Grant this Domain Account (DomainName/UserName) access in the SQL Server Database for the necessary databases. 3. Use Impersonation in your web.config (setting identity impersonate="true") in the web.config of your application. Now, while enabling impersonation, you can either set the username and password in the web.config itself as follows:- However this defeats the process of security as you are again storing the password in the web.config file. The second method is to simply set identity impersonate to true and assign the username and password in the IIS. To do that, do the following steps


Copyright © 2005-2011 Narola Infotech, Custom Software & Website Development Company | All Rights Reserved.