Accessing SQL Server as a Local User
When an ASP.NET application runs, by default it runs in the context of a special local user called ASPNET (in Windows 2000 and Windows XP) or NETWORK SERVICE (in Windows Server 2003). This user account has just enough permissions on the Web server computer to allow the application to run.
If SQL Server and the Web server are on the same computer, you can define the ASPNET or NETWORK SERVICE user as a user on the SQL Server.
The advantages of this method are that it is secure, because the Web application runs within a limited security context. Using a single user name with SQL Server is also efficient because it enables SQL Server to take advantage of connection pooling, enhancing the scalability of the application.
To give the ASPNET or NETWORK SERVICE user SQL Server permissions
- From the Windows Start menu, choose Microsoft SQL Server, and then choose Enterprise Manager.
- Open the node for the server and expand the node for the database you want to give users permissions for.
- Right-click the Users node and choose New Database User.
- In the Database User Properties dialog box, enter computername
\ASPNET in the Login name box, and then click OK.