SQL Server authentication

V

vivek

Hello Bill,

Following situation is really confusing me and I am unable
to solve this issue. Could you please kindly go through
this.

I have a client written in Visual C# which accesses SQL
Server database and updates the tables.

This is the connection string:
string connectionString = @"Data Source=560dbserver;"+
@"Initial Catalog=cisdb;"+@"user
id=ASPNET;"+@"password=guest;"+@"Integrated
Security=false";

I have commented "authorization", "authentication"
and "impersonate" elements in my web.config i.e., neither
am I using Windows Integrated Security nor trusted
connections to access my SQL Server.

I have my SQL Server setup at mixed mode authentication
and I have created account for "ASPNET" user with a
password "guest".

Now, when I run the web application it gives
me the following error:
Exception Details: System.Data.SqlClient.SqlException:
Login failed for user 'ASPNET'.

I am surprised why access is denied to ASPNET even though
my SQL Server is on Mixed mode with account created for
ASPNET. Can you please clarify me on this issue?

Thanks
 
W

William \(Bill\) Vaughn

Ah, I don't run this list... I'm just another resource here.
I would use some other name--not ASPNET. Try to create an account "Fred"
with a password and see if that works.
hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
A

Achintya Bakre

I am trying following things and it is working. See if it
is helpful for you

On Sql Server:
Authentication: Sql Server and Windows
Audit Level : None

I created a user ASPNET assigned default database say TCM
Added ASPNET user in TCM users list and granted select
permissions on required tables.

I have commented authorization and authentication in
web.config same as you.

Then I am trying following code in pageload event
SqlConnection cn = new
SqlConnection();
cn.ConnectionString="integrated
security=false;data source=localhost;initial
catalog=TCM;user id=ASPNET;password=guest;";
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection=cn;
cmd.CommandType=CommandType.Text;
SqlDataReader dr;
cmd.CommandText="select * from T1
where caseid=1";
dr=cmd.ExecuteReader();
dr.Read();
Response.Write(dr["CaseTitle"]);


This is giving me proper results.

Hope it helps.

Achintya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top