Reputation: 12367
I have a ASP.NET website. It's got a login page where I use built-in Membership class for user authentication. I've got a weird problem. In visual Studio when I point to my Default.aspx file and select View in browser I have no problem, I enter credentials and authenticate. But when I open the same website from the browser directly (localhost/MyWebsite) either authentication fails or I get the following error:
Cannot open database requested by the login. The login failed.Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’."
I use SQL Server express for Membership. I've put the mdf file in the App_Data folder.
Upvotes: 1
Views: 93
Reputation: 21355
If you are using::
Integrated Security
In your connection string, then it only means that ASP.Net is trying to connect with your database using the current AppPool identity in this case, the AUTHORITY\NETWORK SERVICE
You could change your database authentication mechanism to use a user/password and avoid this problem
Another solution is grant required permissions to the AUTHORITY\NETWORK SERVICE user in your database
Upvotes: 1