Solved

Error!!

Posted on 2006-07-16
6
171 Views
Last Modified: 2010-04-16
Hi Experts ..

Login failed for user 'CO-B080FE8CE82C\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'CO-B080FE8CE82C\ASPNET'.

Source Error:


Line 36:                   if(!IsPostBack)
Line 37:                   {
Line 38:                         sqlDataAdapter1.Fill(dsPizzaStores1);
Line 39:                         sqlDataAdapter2.Fill(dsPizzaStores1);
Line 40:             
 
I don't know why this error occured??
this is my connection string :

this.sqlConnection1.ConnectionString = "workstation id=\"CO-B080FE8CE82C\";packet size=4096;integrated security=SSPI;data source=\"CO-B080FE8CE82C\";persist security info=False;initial catalog=PizzaStore";

..??
            
0
Comment
Question by:DrAske
  • 3
  • 3
6 Comments
 
LVL 7

Expert Comment

by:whatsit2002
ID: 17118083
You need to give the ASPNET user access to the database or impersonate a user that already has database access. You can impersonate another user by adding this line to the web.config:

<identity impersonate="true" userName="CO-B080FE8CE82C\database_user" password="dbpassword"/>

Also, giving the ASPNET user access to resources (such as a database) can be a security risk, so I would recommend impersonating another user.

A second option would be to use SQL User Authentication instead of an SSPI context.

Thanks.

Jason
0
 
LVL 9

Author Comment

by:DrAske
ID: 17118116
Actually ... I'm not familiar in web.config ?? I'm studing ADO.NET and I am developing a sample project (Asp.net web application project instead of using windows-Forms) ..

so how to set SQL User Authentication ??
0
 
LVL 7

Expert Comment

by:whatsit2002
ID: 17118195
To use SQL User Authentication, your sql server must be setup to support it. If it is, simply change your connection string to something like:

"server=CO-B080FE8CE82C;user id=sqluser;password=mypassword;initial catalog=PizzaStore;"

Where sqluser and mypassword are the user credentials for your sql user.

Jason
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 9

Author Comment

by:DrAske
ID: 17118282
I added a new user using Enterprize Manager .. User = pizza ; password= pwpizza
but it gives another error :

Login failed for user 'pizza'. Reason: Not associated with a trusted SQL Server connection.

this.sqlConnection1.ConnectionString = "data source=CO-B080FE8CE82C;initial catalog=PizzaStore;user id=pizza; Password=pwpizza";

sorry for this stupid question :(
0
 
LVL 7

Accepted Solution

by:
whatsit2002 earned 500 total points
ID: 17118881
Try this:

1) Open Enterprise Manager.
2) Right-click on the SQL server instance
3) Choose "Properties" from the context menu. The "SQL Server Properties (Configure)" window will open
4) Choose the "Security" tab and make sure that under the "Authentication" header that "SQL Server and Windows" is selected.

That will enable SQL Server authentication so that your connection string will work.

Thanks.

Jason
0
 
LVL 9

Author Comment

by:DrAske
ID: 17120314
Well *whatsit2002* .. it worked ..
Thanx alot ..
and sorry for wasting your time ..

regards, Ahmad;
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now