System.Data.SqlClient.SqlException: Login failed for user 'MachineName\ASPNET'
SQL Server 2000 Enterprise Manager
1. If you are using a sql-server database, open enterprise manager. (The enterprise manager will be available within the
sqlserver program group in windows. Start->Programs->Microsoft SQL Server->enterprise manager)
2. In the ( database window ( left pane ) locate your database and expand. You will see tables, view,
users etc listed below. Dblclick the users icon. On the right pane dblclick the machiname\ASPNET user you had created
earlier. This will open up the "database user properties" window. You will see that the database role "public" is already selected.
3. Now additionally select the db_datareader role as well. Click apply.
This will give the database read permission to the ASPNET user and hopefully fix your problem.
SQL SERVER Management Studio Express
1. Open Microsoft SQL Server Management Studio Express
2. Navigate to the Machine database\Security\Logins
3. Create a New Login (Right click in the Logins pane
4. In 'Login name:' type MachineName\ASPNET
5. Make sure 'Windows authentication' is selected
6. Under User Mappings, check all the databases you will use in the mapped window
7. Then check 'db_datareader' in the role memebership for each database
8. You may have to do others like, db_datawriter to do updates, I'm not sure
Note:
You may have to make sure that the user role you are using is allowed
to perform SELECT's, UPDATE's, etc... on the tables your are trying to hit.
1. Rightclick on the tables and look at the permissions.
2. Add the role/user if necessary and grant permissions where needed.