471,337 Members | 934 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

SQL Server login failing

I am getting the following error:

*********
Login failed for user 'AUM\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
'AUM\ASPNET'.
*********
It is failing on the dbConnection.Open(); line

I am using the following to connect (this is from a tutorial in a book):
************
string connectionString =
ConfigurationSettings.AppSettings["ConnectionString"];
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
string queryString = "Select count([Fans].[FanEmail]) from [Fans] where
([Fans].[FanEmail] = @FanEmail)";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
************

I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?
Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
Aug 19 '07 #1
11 1667
This is a SQL Server issue, not a C# Language issue - it would happen in any
language.

"Login failed for user 'AUM\ASPNET'" means your app is configured so that
the default ASPNET account on the machine, which obviously does NOT have
credentials to login to the SQL Server, is what is trying to log in.

The solution is to use a specified SQL Server login in the connection
string,and ensure that "Mixed mode" (both Windows and SQL Server)
authentication is enabled on the SQL Server.

The exception message is quite clear. The only problem is often we simply
don't take the time to read it and comprehend.
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Anil Gupte" wrote:
I am getting the following error:

*********
Login failed for user 'AUM\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
'AUM\ASPNET'.
*********
It is failing on the dbConnection.Open(); line

I am using the following to connect (this is from a tutorial in a book):
************
string connectionString =
ConfigurationSettings.AppSettings["ConnectionString"];
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
string queryString = "Select count([Fans].[FanEmail]) from [Fans] where
([Fans].[FanEmail] = @FanEmail)";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
************

I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?
Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
Aug 19 '07 #2
Anil Gupte wrote:
Login failed for user 'AUM\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
'AUM\ASPNET'.
*********
I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?
Go into OSQL and enter:

SP_GRANTLOGIN 'AUM\ASPNET'
GO
USE yourdatabase
GO
SP_GRANTDBACCESS 'AUM\ASPNET','ASPNET'
GO
GRANT whateveryouwantaspnettobeabletodo TO ASPNET
GO

Arne
Aug 19 '07 #3
I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?
Thanx,
This must be an ASP.NET 2003 solution with the ASPNET worker process using
the ASPNET account coming into play with any ASP.NET solution that accessing
a MS SQL Server database. This seems to be the case, and the (machine
name/ASPNET) account must be an account that is established on the MS SQL
Server database with full permissions to access the database.

Aug 20 '07 #4
Thanx. If I wanted to do it using the connection string, how would I do it?

--
Anil Gupte
www.keeninc.net
www.icinema.com

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
Anil Gupte wrote:
>Login failed for user 'AUM\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 'AUM\ASPNET'.
*********
>I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?

Go into OSQL and enter:

SP_GRANTLOGIN 'AUM\ASPNET'
GO
USE yourdatabase
GO
SP_GRANTDBACCESS 'AUM\ASPNET','ASPNET'
GO
GRANT whateveryouwantaspnettobeabletodo TO ASPNET
GO

Arne

Aug 20 '07 #5
Perhaps I should have phrased the question better. How can I use a
connection string to allow my program to login? I can create a user under
SQL Server, but I don't know how to include the login in the connection
string.

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.comwrote
in message news:E4**********************************@microsof t.com...
This is a SQL Server issue, not a C# Language issue - it would happen in
any
language.

"Login failed for user 'AUM\ASPNET'" means your app is configured so that
the default ASPNET account on the machine, which obviously does NOT have
credentials to login to the SQL Server, is what is trying to log in.

The solution is to use a specified SQL Server login in the connection
string,and ensure that "Mixed mode" (both Windows and SQL Server)
authentication is enabled on the SQL Server.

The exception message is quite clear. The only problem is often we simply
don't take the time to read it and comprehend.
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Anil Gupte" wrote:
>I am getting the following error:

*********
Login failed for user 'AUM\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
'AUM\ASPNET'.
*********
It is failing on the dbConnection.Open(); line

I am using the following to connect (this is from a tutorial in a book):
************
string connectionString =
ConfigurationSettings.AppSettings["ConnectionString"];
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStr ing);
string queryString = "Select count([Fans].[FanEmail]) from [Fans] where
([Fans].[FanEmail] = @FanEmail)";
System.Data.IDbCommand dbCommand = new
System.Data.SqlClient.SqlCommand();
************

I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?
Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com

Aug 20 '07 #6

"Anil Gupte" <an*******@icinema.comwrote in message
news:up**************@TK2MSFTNGP02.phx.gbl...
Thanx. If I wanted to do it using the connection string, how would I do
it?
You can't give the ASPNET machine account in a connection string. The ASPNET
worker process is the one that is using that ASPNET account, which was
installed on the machine when the .Net Framework 1.1 was installed on the
machine. It's a special account like the System account that the NT based
O/S like Win 2K and XP uses to do things.

It seems that you don't understand how ASP.Net works with ADO.NET using .NET
2003 and .Net Framework 1.1 accessing MS SQL Server, where as, the ASPNET
worker process that running with the ASP.Net solution is using that machine
name/ASPNET account, and that machine name/ASPNET account must be
established on the SQL Server database.

You have two accounts that must be accounted for if a .NET 2003 ASP.NET
application using ADO.NET that is accessing a database on SQL Server.

One account is the user account and psw that you have created for the SQL
Server database to be accessed or you are using the SQL Server Administrator
(SA account and psw). Either one of those type of accounts, you can give it
in the ADO.NET connection string so that your application can logon to SQL
server and access the database.

Then there is that machine name/ASPNET account (a special account) that the
ASPNET worker process (ASP.NET itself) is using that you cannot give in a
connection string, but that machine name/ASPNET account must be accounted
for on the SQL Server database so that ASP.NET itself (the ASPNET worker
process) can access the SQL Server database.

I suggest that you use Google and look-up what the ASPNET machine account is
about in regards to running a 2003 ASP.NET solution that must access SQL
Server.

Aug 20 '07 #7
Thanx, but what is OSQL? I tried this Query Analyser, and the first part
seems to work, but I stumbled on this:

GRANT dbo.owner TO ASPNET

Obviously the syntax is incorrect for dbo.owner, but what should it be?

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
Anil Gupte wrote:
>Login failed for user 'AUM\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 'AUM\ASPNET'.
*********
>I am using a local SQL server (installed with my VS.Net 2003. How can I
allow it to login or use the dbo user to do the database stuff?

Go into OSQL and enter:

SP_GRANTLOGIN 'AUM\ASPNET'
GO
USE yourdatabase
GO
SP_GRANTDBACCESS 'AUM\ASPNET','ASPNET'
GO
GRANT whateveryouwantaspnettobeabletodo TO ASPNET
GO

Arne

Aug 20 '07 #8
You are right, I seem to not understand how these accounts interact.

Why can't I run my application under a user of my choice as long as it is a
vali acoount on the domain and has the right permissions?

Actually, I have added the user machine_name/ASPNET to the database, and it
appears to work, but I am trying to learn, so pardon the questions. :-)

And thanx for your patience in replying.
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:u9**************@TK2MSFTNGP05.phx.gbl...
>
"Anil Gupte" <an*******@icinema.comwrote in message
news:up**************@TK2MSFTNGP02.phx.gbl...
>Thanx. If I wanted to do it using the connection string, how would I do
it?

You can't give the ASPNET machine account in a connection string. The
ASPNET worker process is the one that is using that ASPNET account, which
was installed on the machine when the .Net Framework 1.1 was installed on
the machine. It's a special account like the System account that the NT
based O/S like Win 2K and XP uses to do things.

It seems that you don't understand how ASP.Net works with ADO.NET using
.NET 2003 and .Net Framework 1.1 accessing MS SQL Server, where as, the
ASPNET worker process that running with the ASP.Net solution is using that
machine name/ASPNET account, and that machine name/ASPNET account must be
established on the SQL Server database.

You have two accounts that must be accounted for if a .NET 2003 ASP.NET
application using ADO.NET that is accessing a database on SQL Server.

One account is the user account and psw that you have created for the SQL
Server database to be accessed or you are using the SQL Server
Administrator (SA account and psw). Either one of those type of accounts,
you can give it in the ADO.NET connection string so that your application
can logon to SQL server and access the database.

Then there is that machine name/ASPNET account (a special account) that
the ASPNET worker process (ASP.NET itself) is using that you cannot give
in a connection string, but that machine name/ASPNET account must be
accounted for on the SQL Server database so that ASP.NET itself (the
ASPNET worker process) can access the SQL Server database.

I suggest that you use Google and look-up what the ASPNET machine account
is about in regards to running a 2003 ASP.NET solution that must access
SQL Server.

Aug 20 '07 #9

"Anil Gupte" <an*******@icinema.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
You are right, I seem to not understand how these accounts interact.

Why can't I run my application under a user of my choice as long as it is
a vali acoount on the domain and has the right permissions?
You are doing that when you give a user-id and psw of your making that has
been , the SQL Server SA account and psw or Integrated security=SSPI account
that has been established on the SQL Server database in the ADO.NET
connection string.

The Integrated Security means take the user-id and psw the user logged in on
the workstation with if SQL Server is running local on the workstation or
use the user's domain user ID and psw if the SQL Server machine is on the
domain network and logon to SQL server, which the accounts must me
established on the SQL server data base.
>
Actually, I have added the user machine_name/ASPNET to the database, and
it appears to work, but I am trying to learn, so pardon the questions. :-)
The aspnet_wp.exe is there and it's running with your ASP.NET application on
IIS. Aspnet_wp.exe must access the SQL Server database, along with your
ASP.NET application. The aspnet_wp.exe has its own special account that it
uses called machine_name/ASPNET.

http://www.xefteri.com/articles/show.cfm?id=14

Below is another area where the machine_Name/ASPNET account is going to come
into play if it's not accounted for with using a .Net 2003 ASP.Net solution.

http://www.asp.net/learn/whitepapers...s-directories/


Aug 20 '07 #10
Anil Gupte wrote:
Thanx. If I wanted to do it using the connection string, how would I do it?
With integrated windows security you do not specify any username in
the connection string.

If you want to specify a username and a password you need to enable
SQLServer security (mixed mode).

Another poster has give you instructions for this. But I would
recommend integrated security.

Arne
Aug 21 '07 #11
Anil Gupte wrote:
Thanx, but what is OSQL? I tried this Query Analyser, and the first part
seems to work, but I stumbled on this:

GRANT dbo.owner TO ASPNET

Obviously the syntax is incorrect for dbo.owner, but what should it be?
OSQL is a command line utility that comes with SQLServer.

You can also use QA.

Se GRANT syntax at:
http://msdn2.microsoft.com/en-us/lib...9(SQL.80).aspx

Arne
Aug 21 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Ben Dewey | last post: by
8 posts views Thread by =?Utf-8?B?U2hlcndvb2Q=?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.