473,788 Members | 2,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sql Client.SqlExcep tion: Login failed for user
'AUM\ASPNET'.
*********
It is failing on the dbConnection.Op en(); line

I am using the following to connect (this is from a tutorial in a book):
************
string connectionStrin g =
ConfigurationSe ttings.AppSetti ngs["ConnectionStri ng"];
System.Data.IDb Connection dbConnection = new
System.Data.Sql Client.SqlConne ction(connectio nString);
string queryString = "Select count([Fans].[FanEmail]) from [Fans] where
([Fans].[FanEmail] = @FanEmail)";
System.Data.IDb Command dbCommand = new System.Data.Sql Client.SqlComma nd();
************

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 1808
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.Sql Client.SqlExcep tion: Login failed for user
'AUM\ASPNET'.
*********
It is failing on the dbConnection.Op en(); line

I am using the following to connect (this is from a tutorial in a book):
************
string connectionStrin g =
ConfigurationSe ttings.AppSetti ngs["ConnectionStri ng"];
System.Data.IDb Connection dbConnection = new
System.Data.Sql Client.SqlConne ction(connectio nString);
string queryString = "Select count([Fans].[FanEmail]) from [Fans] where
([Fans].[FanEmail] = @FanEmail)";
System.Data.IDb Command dbCommand = new System.Data.Sql Client.SqlComma nd();
************

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.Sql Client.SqlExcep tion: 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_GRANTDBACCES S 'AUM\ASPNET','A SPNET'
GO
GRANT whateveryouwant aspnettobeablet odo 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.d kwrote in message
news:46******** *************** @news.sunsite.d k...
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.Sql Client.SqlExcep tion: 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_GRANTDBACCES S 'AUM\ASPNET','A SPNET'
GO
GRANT whateveryouwant aspnettobeablet odo 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*******@yaho o.yohohhoandabo ttleofrum.comwr ote
in message news:E4******** *************** ***********@mic rosoft.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.Sql Client.SqlExcep tion: Login failed for
user
'AUM\ASPNET' .
*********
It is failing on the dbConnection.Op en(); line

I am using the following to connect (this is from a tutorial in a book):
************
string connectionStrin g =
ConfigurationS ettings.AppSett ings["ConnectionStri ng"];
System.Data.ID bConnection dbConnection = new
System.Data.Sq lClient.SqlConn ection(connecti onString);
string queryString = "Select count([Fans].[FanEmail]) from [Fans] where
([Fans].[FanEmail] = @FanEmail)";
System.Data.ID bCommand dbCommand = new
System.Data.Sq lClient.SqlComm and();
************

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*******@icin ema.comwrote in message
news:up******** ******@TK2MSFTN GP02.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.d kwrote in message
news:46******** *************** @news.sunsite.d k...
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.Sql Client.SqlExcep tion: 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_GRANTDBACCES S 'AUM\ASPNET','A SPNET'
GO
GRANT whateveryouwant aspnettobeablet odo 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.c omwrote in message
news:u9******** ******@TK2MSFTN GP05.phx.gbl...
>
"Anil Gupte" <an*******@icin ema.comwrote in message
news:up******** ******@TK2MSFTN GP02.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*******@icin ema.comwrote in message
news:%2******** ********@TK2MSF TNGP06.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
3275
by: Kristof Thys | last post by:
Hello, I'm developing a C# - windows forms application. To get some information for my application, I'm connecting to an URL, wich gives me XML generated using php. With 90% of the users, this code just works fine: WebRequest request = WebRequest.Create(URL);
7
2748
by: Reza | last post by:
Hello The project was working, where I had a domain user registered in the database as a user, and I used that user to connect the datebase. Everything was fine and it was working, then when I moved the project to the production servers - database server and web server. Following that all the users are failing to connct to database, getting this message "login failed for user 'username' I am getting the user with property identity and it...
3
1155
by: Irishmaninusa | last post by:
Hello Everyone, I have a very simple login screen that basically allows the user to login into the system. If I access the page from on the server then I get logged into the system everytime. However, if I try to access the system from any other machine I get bounced to the login screen everytime and I am not exactly sure why that is the case. I am using asp.net 1.1 and running on Windows2000 server. I was wondering if any one has...
7
1512
by: Oenone | last post by:
Sorry for the cross-post but I've really no idea where this is best suited. I've an ADO.NET application which connects to a SQL Server database. I have spent the entire morning trying to get it to connect, but eventually got it working by setting (in the web.config file) the authentication mode to "Windows" and the identity impersonate flag to "True". I have left the identity username blank so that it picks up the username and password...
9
5451
by: Tim Baley | last post by:
I recently created some intranet web sevices to expose stored procedures on our SQL Servers (SQL2k). The stored procedures include an audit trail with user/login identification, so the web services are set up for Windows integrated authentication. The web sevices work well when they are hosted on IIS on my Win2k Pro development machine. I have tried accessing the services under several user accounts on several machines, including...
5
875
by: Ben Dewey | last post by:
This is a repost, But I have some new information. I have a server that is configured for .NET 1.1 and 2.0. For some reason all my postback events for aren't firing when using .NET 1.1. Under IIS in ASP.NET tab, if i switch to 2.0 then the events fire correctly, but my code is not set up for that so i get some random errors. And when i switch back to 1.1 my events still don't fire Anyone know why my post backs are not firing in 1.1?
2
1232
by: markelc | last post by:
I've created several new users through the CreateUserWizard without a hitch but when I can't login using the login server control with any of them. How do I troubleshoot this problem? I've used SQL Server Profiler and it seems to be getting hung up on the aspnet_Membership_GetPasswordWithFormat procedure which is apparently failing on the UTC date. I'm not sure how to proceed further? Thanks!
4
4381
by: BenM | last post by:
I have to connect to two SQLServers in my script. One server is local, the other is remote. I am using ODBC for the local connection: pasConnStr = "Driver={SQL Server};" & _ "Server=(local);" & _ "DataBase=PAS" And I have tried various connections to the remote server, this one happens to be oledb:
8
4699
by: =?Utf-8?B?U2hlcndvb2Q=?= | last post by:
Greetings, I am attempting to use the following code to establish a connection to a SQL Server database. However, when I execute the code, I receive the following error: "Login failed for user 'guest'. The user is not associated with a trusted SQL Server connection." SqlConnection conn = new SqlConnection("Data
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.