Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

Can't login from internet

I have created a web using VB 2005 that uses ASPNETDB.MDF. I can login when running in debug but not through the net . I get this error when running through the net
Server Error in '/' Application.
Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
I suspect it has something to do with permissions. Can anyoone help?
  • 2
2 Solutions
You've created a web?

Also, a .MDF indicates that it's a MS Access database file.  If that's the case, then how do you expect to access it through the net?  MS Access would have to have a third party "server" software for it to be accessible through the internet.

Javin007 MDF is SQL database not Access (mdb).  But your question makes sense: Does your server (where you store the database) as support to SQL ? And does you connection string are ok ?
Ah, I stand corrected.  Thanks, Jpaulino.  :)

whiwexAuthor Commented:
Found this and it fixed it

First of all, if the ASPNET account is missing on your system, I'd advice the following steps (Note: Your account must be a member of the Administrators group!):

1. Start Notepad. Verify that Word Wrap is turned off
2. Paste this code in Notepad:

@echo off
echo "Stopping IIS."
iisreset /stop
echo "----------------------"
echo "Stopping ASP.NET State Service!"
net stop aspnet_state
echo "----------------------"
echo "Creating a new ASPNET account with a temporary password."
net user ASPNET 1pass@word /add
echo "----------------------"
echo "Creating a profile."
echo "Type 1pass@word when you are prompted for the temporary password."
runas /profile /user:ASPNET cmd.exe
echo "----------------------"
echo "Reregistering ASP.NET and the ASPNET account."
aspnet_regiis -i
echo "A new random password has been autocreated for the ASPNET account."
echo "----------------------"
echo "Restarting IIS."
iisreset /start
echo "----------------------"
echo "You should have your ASPNET account now, sbasha ;-)"

3. Save the file as c:\createASPNETuser.cmd
4. Click Start, and then click Run
5. Type cmd.exe, and then press ENTER
6. At the command prompt, type c:\createASPNETuser.cmd, and then press ENTER
7. When you are prompted for a password, type 1pass@word
    -> A second command prompt window appears!
8. After you apply this patch, type exit in the second command prompt window, and then press ENTER

With step 8. you've added a ASPNET account on your system which you can add (as user) to the appropriate database ...

... but we're not done yet ... ;-) ...

... under Windows Server 2003, the NT AUTHORITY/NETWORK SERVICE database user is part of the IIS Worker Process Group. In the SQL Server Login Properties not only click on add "ASPNET" to add this user as a Login for the selected database. You'll also have to give rights to the "NT AUTHORITY/NETWORK SERVICE" user, which was the user that your ASP.NET web application tried to use to access your database ... one of the reasons for your question!

Best regards,

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now