Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Error: Login Failed

Status
Not open for further replies.

Marmalade

Technical User
Jan 30, 2002
29
US
Hi,

I'm trying to connect to a SQL Server 2000 database using a Data Reader in a Web Form page, and I can't manage to log into the database. This is true whether I opt to use Windows NT Integrated Security or a specific username and password when setting the Connection String in the Data Link properties box in VS.NET.

Using either option, my test connection always works; when I try to Build and Browse the page, however, it always fails at the SqlConnection1.Open() line in my code due to failed user login. Oddly, I have no problem logging into SQL Server itself to work on the database using the Query Analyzer or Enterprise Manager.

Does anyone know why this might be happening?

 
What is your connection string (just *** out username and pwd)?
 
I went in to copy it, and realized that my password was missing! Now it works perfectly, of course. Windows NT Integrated Security still doesn't work - could that be because Basic Authentication isn't automatically enabled for the application under IIS?

Thanks,
M
 
If you used the Data Link Properties dialog to make your connections you need to make sure to check off save password, if you specify a specific user.

As for the windows authenticated there are a couple of line you need to add to get this to use the proper windows user. If you don't add these lines the application trys to login using the ASPNET/someuser account.

In the web.config file add this line under the <system.web> tag
<identity impersonate=&quot;true&quot;/>

Also using the IIS tool open up the properties for your project
Click the Directory Security tab
Click the edit button in the Anonymous access and authentication control section
Clear the Anonymous Access check box
Check the Integrated Windows authentication box

If you are using WebServices for your data access then a few more steps need to be taken. Follow the above steps for the webservices project as well as the client project.
When you call the webservices from your client add the following code.
dim ws as new 'webservice call here
ws.Credentials = System.Net.CredentialCache.DefaultCredentials


You just needed to setup the application so that the proper user credentials are passed to the connection.

Hope this helps you. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Thanks, Zarcom. What are the advantages or benefits of using Windows integrated security, anyhow?
 
This might help a little.

Basically integrated security is for non web usage. If your application runs on an intranet and your company has domains and groups setup with different security access you can use these existing accounts to limit access to the database rather than making an entirely new set of users for the application. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Thanks! I was able to get integratee security working by following your instructions, and that article gave me a much better understanding of what's going on.
 
np That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top