dbTalk Databases Forums  

Login fails. Login failed for user 'LAPTOP\ASPNET'

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Login fails. Login failed for user 'LAPTOP\ASPNET' in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
WJH
 
Posts: n/a

Default Login fails. Login failed for user 'LAPTOP\ASPNET' - 03-04-2004 , 04:07 PM






I'm trying to open a connection to a local SQLSERVER database (on my
computer named Laptop).

The following code works in WebMatrix, but cut and pasted into Visual Studio
it doesn't work. In Visual Studio, I get an error message, "Cannot open
database requested in login 'certainteed'. Login fails. Login failed for
user 'LAPTOP\ASPNET'".

string connectionString = "server=\'(local)\'; trusted_connection=true;
database=\'certainteed\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
IDbConnection.Open();

If I change one word in the connection string, 'certainteed' to 'store', the
code works to open a connection to that database which is on a different
local web site.

Can you reconcile these facts to see a possible solution, so that I could
use Visual Studio to establish the connection to the certaineed database?

Thanks in advance



Reply With Quote
  #2  
Old   
James Goodman
 
Posts: n/a

Default Re: Login fails. Login failed for user 'LAPTOP\ASPNET' - 03-05-2004 , 03:00 AM






I am assuming you are not logging in to your computer as user 'ASPNET'.

If you want to login as yourself to SQL Server, you need to set the
properties for your website to only allow Windows Authentication. If
Anonymous access is enabled, by default all users will attempt to login as
user 'COMPUTER\ASPNET'.

If you do want to login as user 'ASPNET', you will need to add the login to
the SQL server instance on your laptop.


--
James Goodman
MCSE MCDBA
http://www.angelfire.com/sports/f1pictures/
"WJH" <intLink (AT) adelphia (DOT) net> wrote

Quote:
I'm trying to open a connection to a local SQLSERVER database (on my
computer named Laptop).

The following code works in WebMatrix, but cut and pasted into Visual
Studio
it doesn't work. In Visual Studio, I get an error message, "Cannot open
database requested in login 'certainteed'. Login fails. Login failed for
user 'LAPTOP\ASPNET'".

string connectionString = "server=\'(local)\'; trusted_connection=true;
database=\'certainteed\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
IDbConnection.Open();

If I change one word in the connection string, 'certainteed' to 'store',
the
code works to open a connection to that database which is on a different
local web site.

Can you reconcile these facts to see a possible solution, so that I could
use Visual Studio to establish the connection to the certaineed database?

Thanks in advance





Reply With Quote
  #3  
Old   
WJH
 
Posts: n/a

Default Re: Login fails. Login failed for user 'LAPTOP\ASPNET' - 03-05-2004 , 10:22 AM



I don't care how I log on as long as I, and anyone else accessing the site,
can open the web page that includes the data from the database (I think that
requires anonymous access being enabled).

What I don't understand is how the 3 lines of code below can work when run
in Web Matrix, but not work when run in Visual Studio or accessed directly
by my browser. If I could figure that out, I could presumably fix the
problem.

Bear in mind also, that a number of possible causes of the problem can be
ruled out by the fact that the code works fine if I change 'certainteed' to
'store'.

What do you think?

"James Goodman" <james (AT) norton-associates (DOT) REMOVE.co.uk> wrote

Quote:
I am assuming you are not logging in to your computer as user 'ASPNET'.

If you want to login as yourself to SQL Server, you need to set the
properties for your website to only allow Windows Authentication. If
Anonymous access is enabled, by default all users will attempt to login as
user 'COMPUTER\ASPNET'.

If you do want to login as user 'ASPNET', you will need to add the login
to
the SQL server instance on your laptop.


--
James Goodman
MCSE MCDBA
http://www.angelfire.com/sports/f1pictures/
"WJH" <intLink (AT) adelphia (DOT) net> wrote in message
news:yuCdnSxB7tE0NdrdRVn-sA (AT) adelphia (DOT) com...
I'm trying to open a connection to a local SQLSERVER database (on my
computer named Laptop).

The following code works in WebMatrix, but cut and pasted into Visual
Studio
it doesn't work. In Visual Studio, I get an error message, "Cannot open
database requested in login 'certainteed'. Login fails. Login failed for
user 'LAPTOP\ASPNET'".

string connectionString = "server=\'(local)\'; trusted_connection=true;
database=\'certainteed\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
IDbConnection.Open();

If I change one word in the connection string, 'certainteed' to 'store',
the
code works to open a connection to that database which is on a different
local web site.

Can you reconcile these facts to see a possible solution, so that I
could
use Visual Studio to establish the connection to the certaineed
database?

Thanks in advance







Reply With Quote
  #4  
Old   
David Schleifer [MSFT]
 
Posts: n/a

Default Re: Login fails. Login failed for user 'LAPTOP\ASPNET' - 03-05-2004 , 04:06 PM



What's probably happening is that Web Matrix is making the connection to sql
server as the logged-on user (i.e. yourself) and since youre login has
access to the database, it works.

Visual Studio is making the connection through the account that IIS runs
under, i.e. ASPNET. So you want to add the ASPNET login to the database,
with whatever set of rights your application would need.

- Dave

"WJH" <intLink (AT) adelphia (DOT) net> wrote

Quote:
I don't care how I log on as long as I, and anyone else accessing the
site,
can open the web page that includes the data from the database (I think
that
requires anonymous access being enabled).

What I don't understand is how the 3 lines of code below can work when run
in Web Matrix, but not work when run in Visual Studio or accessed directly
by my browser. If I could figure that out, I could presumably fix the
problem.

Bear in mind also, that a number of possible causes of the problem can be
ruled out by the fact that the code works fine if I change 'certainteed'
to
'store'.

What do you think?

"James Goodman" <james (AT) norton-associates (DOT) REMOVE.co.uk> wrote in message
news:c29fip$j6l$1 (AT) hercules (DOT) btinternet.com...
I am assuming you are not logging in to your computer as user 'ASPNET'.

If you want to login as yourself to SQL Server, you need to set the
properties for your website to only allow Windows Authentication. If
Anonymous access is enabled, by default all users will attempt to login
as
user 'COMPUTER\ASPNET'.

If you do want to login as user 'ASPNET', you will need to add the login
to
the SQL server instance on your laptop.


--
James Goodman
MCSE MCDBA
http://www.angelfire.com/sports/f1pictures/
"WJH" <intLink (AT) adelphia (DOT) net> wrote in message
news:yuCdnSxB7tE0NdrdRVn-sA (AT) adelphia (DOT) com...
I'm trying to open a connection to a local SQLSERVER database (on my
computer named Laptop).

The following code works in WebMatrix, but cut and pasted into Visual
Studio
it doesn't work. In Visual Studio, I get an error message, "Cannot
open
database requested in login 'certainteed'. Login fails. Login failed
for
user 'LAPTOP\ASPNET'".

string connectionString = "server=\'(local)\';
trusted_connection=true;
database=\'certainteed\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
IDbConnection.Open();

If I change one word in the connection string, 'certainteed' to
'store',
the
code works to open a connection to that database which is on a
different
local web site.

Can you reconcile these facts to see a possible solution, so that I
could
use Visual Studio to establish the connection to the certaineed
database?

Thanks in advance









Reply With Quote
  #5  
Old   
WJH
 
Posts: n/a

Default Re: Login fails. Login failed for user 'LAPTOP\ASPNET' - 03-06-2004 , 01:47 PM



Thanks, using the free download from Microsoft "Sql Web Data Administrator"
I granted login access to LAPTOP\ASPNET, and my problem was solved

Thanks again

************************************************** ******
The SQL Server Web Data Administrator enables you to easily manage your SQL
Server data, wherever you are. Using its built-in features, you can do the
following from Microsoft Internet Explorer or your favorite Web browser:

Create and edit databases in SQL Server 2000 or Microsoft SQL Server 2000
Desktop Engine (MSDE 2000)
Perform ad-hoc queries against databases and save them to your file system
Export and import database schema and data
Manage users and roles
View, create and edit stored procedures

http://www.microsoft.com/downloads/d...displaylang=en

************************************************** *******
"David Schleifer [MSFT]" <dschleif (AT) online (DOT) microsoft.com> wrote

Quote:
What's probably happening is that Web Matrix is making the connection to
sql
server as the logged-on user (i.e. yourself) and since youre login has
access to the database, it works.

Visual Studio is making the connection through the account that IIS runs
under, i.e. ASPNET. So you want to add the ASPNET login to the database,
with whatever set of rights your application would need.

- Dave

"WJH" <intLink (AT) adelphia (DOT) net> wrote in message
news:XcCdnTE5dYPpNNXdRVn-ug (AT) adelphia (DOT) com...
I don't care how I log on as long as I, and anyone else accessing the
site,
can open the web page that includes the data from the database (I think
that
requires anonymous access being enabled).

What I don't understand is how the 3 lines of code below can work when
run
in Web Matrix, but not work when run in Visual Studio or accessed
directly
by my browser. If I could figure that out, I could presumably fix the
problem.

Bear in mind also, that a number of possible causes of the problem can
be
ruled out by the fact that the code works fine if I change 'certainteed'
to
'store'.

What do you think?

"James Goodman" <james (AT) norton-associates (DOT) REMOVE.co.uk> wrote in message
news:c29fip$j6l$1 (AT) hercules (DOT) btinternet.com...
I am assuming you are not logging in to your computer as user
'ASPNET'.

If you want to login as yourself to SQL Server, you need to set the
properties for your website to only allow Windows Authentication. If
Anonymous access is enabled, by default all users will attempt to
login
as
user 'COMPUTER\ASPNET'.

If you do want to login as user 'ASPNET', you will need to add the
login
to
the SQL server instance on your laptop.


--
James Goodman
MCSE MCDBA
http://www.angelfire.com/sports/f1pictures/
"WJH" <intLink (AT) adelphia (DOT) net> wrote in message
news:yuCdnSxB7tE0NdrdRVn-sA (AT) adelphia (DOT) com...
I'm trying to open a connection to a local SQLSERVER database (on my
computer named Laptop).

The following code works in WebMatrix, but cut and pasted into
Visual
Studio
it doesn't work. In Visual Studio, I get an error message, "Cannot
open
database requested in login 'certainteed'. Login fails. Login failed
for
user 'LAPTOP\ASPNET'".

string connectionString = "server=\'(local)\';
trusted_connection=true;
database=\'certainteed\'";
System.Data.IDbConnection dbConnection = new
System.Data.SqlClient.SqlConnection(connectionStri ng);
IDbConnection.Open();

If I change one word in the connection string, 'certainteed' to
'store',
the
code works to open a connection to that database which is on a
different
local web site.

Can you reconcile these facts to see a possible solution, so that I
could
use Visual Studio to establish the connection to the certaineed
database?

Thanks in advance











Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.