Wednesday, March 7, 2012

Needed: User, Login, Connection advice.

HI,
I'm still on the steep side of the learning curve with ASP.NET. I've looked through a number of threads on this forum, and have gotten pieces of the answer, but need help getting past a roadblock.

I haven't been able to get a simple test application to connect to the Pubs database loaded on my system running MSDE. The only control in the application is a WebDataForm created by the Wizard. Everything works well (even the Preview Data form the Data menu loads and displays the correct data), except when the form is viewed in a browser. Click the load button and an error:Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Similar stories are common on this forum, and I tried to address the problem. I'm quite sure it's a autherization or authentication problem. I have Windows Server 2003 (with IIS 6.0), VS.NET 03 and MSDE as the SQL server on the same box. The MSDE server is using Windows Security mode. I Created a new user called ASPNET on the Windows Server. I added a login to the SQL Server 'WinServerName\ASPNET' using windows auth. Still get the same login failed message.

Is there something I'm missing? Do I have to add a new user to IIS?

For the record, what users/settings do I need to have in Windows, SQL-Server and IIS, get past this login problem.

Thanks for answering this basic question - one more time.Hi,
An Addendum to my message:

I found out that WINDOWS SERVER 2003 in native mode (default), running IIS 6.0 Uses "NETWORK SERVICE" rather than "ASPNET" as the default login user name for ASP.NET applications. I had not seen this in the messages I looked through in this forum.

When I, after a number of dead ends, created a new Login for my SQL Server - (as I'm using MSDE, I used The Web Data Administrator rather than Enterprise Manager or OSQL to create the new login) - with the name 'NT AUTHORITY\NETWORK SERVICE', the application was able to access the database through the VS and IE browswers.

As this test application is only used locally, I'm not concerned with the security ramifications of this method of access. However, I can see that it will be a big concern, and a lot of work to establish the appropriate methods when I have a production application to deploy.

I still would welcome advice on what strategies you have used to provide appropriate access privilages to ASP.NET applications and users that will need to access data from SQL Server databases in production environments.

I know that this is asking a lot - as there are so many permutations to consider. What I would hope you could provide, is a base line of "must" and "must never" stepsfor establishing data connections to data sources using ASP.NET.

If this is too open ended a question - let me know your thoughts on that as well. In looking through the messages of the past 3 months on this forum, I know that many have been frustrated by the complxity of getting a database connection established. Yes, the information to get it done is out there, but the sheer volume can be daunting.

Thanks for all you help with my questions.

No comments:

Post a Comment