If you are using SQL Server or MSDE and you get this error, it’s most likely due to the fact that you’re using Integrated Security in your login to the database. For this to work, the ASPNet account needs to have access to the database. This means the ASPNet account must be a user assigned in the database.
You can go to the command prompt and enter the following, based on your own machine’s configuration:
osql -E -S (local)\NetSDK -d puthereyourdatabasename -Q “sp_grantdbaccess ‘YourServer\ASPNET’”
AND THE SECOND ONE
osql -E -S (local)\NetSDK -d puthereyourdatabasename -Q
“sp_addrolemember ‘db_owner’, ‘YourServer\ASPNET’”
One other way to get around it is to use an explicit login and NOT use Integrated Security:
(“server=YourServer;uid=YourUID;pwd=YourPWD;database=YourDatabase”)