Easy way to solve asp. net user ASPNET login failure problem

  • 2020-07-21 07:31:51
  • OfStack

An unhandled exception occurred during the execution of the current Web request. Check the stack trace for details about the error and the source in the code that caused it.
Exception details: System.Data.SqlClient.SqlException: User 'XXXASPNET' failed to log in.
After migrating the website today, I found this problem. After exploration, I found that the reason was that the role of our login database did not have enough permissions for the database.
Solutions:
1. Open Database Enterprise Manager, then select database -- Security -- find the 'XXXASPNET' that just reported an error -- right click "Properties ";
2. Select the "user mapping" option - select the database we want to access
3. Don't click OK - then select which database we just selected, select the "db_owner" permission in "Database Role Membership" below
So that's it.

Related articles: