473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

cannot connect to DB from ASP.Net app

Hi,

from a WinForms-app do I connect to a DB using a connectionstring :

m_sqlConnection.ConnectionString =
" workstation id=\"PC-WIN2000\";
packet size=4096;integrated security=SSPI;
data source=\"PC-WIN2000\\SQLSERVERDB\";
persist security info=False;
initial catalog=Lotto";
That works.

Now, using the same ConnectionString do I try to connect to the same DB
from within a ASP.Net app, but I get an error :
Login failed for user 'PC-WIN2000ASPNET'

First: why doesn't it work ?
and second : where does he get that username ('PC-WIN2000ASPNET' ) from ???

I added User ID = sa; Password=; to the connectionstring but I get exactly
the same error !!!

I downloaded the latest version of MDAC 2.7 servicepack 1 : no improvement

Any ideas ?

chris
Nov 17 '05 #1
1 3541
The reason your connection is working from your WinForms app is because it
is using integrated security and using your currently logged in user account
(the account running the WinForms app) to log into the DB. The ASP.NET app
has Anonymous access enabled, so it is attempting to access the database
using the default ASP.NET anonymous user account, which in your case is
PC-WIN2000ASPNET.

You will need to do one of the following:
1) Specify your connection to use SQL security and pass a valid SQL login
username and password in your connection string (or when you open the
connection).
2) Give the PC-WIN2000ASPNET user account access to the database
3) Set your ASP.NET app to require a login and (if the SQL server is on the
same machine as the ASP.NET app). This is not really a great option unless
you're on an internal network, like an intranet.

Check
http://msdn.microsoft.com/netframewo...secnetch12.asp
for more in-depth info about data access security.
--
Ray Dixon - Microsoft MVP
ra*@NOSPAM.greeble.com
(remove NOSPAM. from my e-mail address for a direct reply)


"Christian" <ch***************@pandora.be> wrote in message
news:pO******************@afrodite.telenet-ops.be...
Hi,

from a WinForms-app do I connect to a DB using a connectionstring :

m_sqlConnection.ConnectionString =
" workstation id=\"PC-WIN2000\";
packet size=4096;integrated security=SSPI; data source=\"PC-WIN2000\\SQLSERVERDB\";
persist security info=False;
initial catalog=Lotto";
That works.

Now, using the same ConnectionString do I try to connect to the same DB
from within a ASP.Net app, but I get an error :
Login failed for user 'PC-WIN2000ASPNET'

First: why doesn't it work ?
and second : where does he get that username ('PC-WIN2000ASPNET' ) from ???
I added User ID = sa; Password=; to the connectionstring but I get exactly
the same error !!!

I downloaded the latest version of MDAC 2.7 servicepack 1 : no improvement

Any ideas ?

chris

Nov 17 '05 #2

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

Similar topics

0
by: Jack Smith | last post by:
Hello, I have PHP 4.3.1.1 running on Windows 2000 Server with IIS 5. This connects to an MS SQL 7 server running on a seperate NT4 box. Recently, this SQL7 Server had SQL7 Service Pack 4...
2
by: Hari Om | last post by:
Cannot connect as Internal Hello, I am using IBM AIX 5.1L box for Oracle 9.2.0.1. I cannot connect as internal to my DB INstance - wonder why? Here is what is do:...
6
by: Jeff Sandler | last post by:
I have a database I created in mySQL. I've been entering data every day into the database using a Java application that I wrote. The database and the Java program are on the same Win 98 SE...
2
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an...
1
by: beck4353 | last post by:
Hi, I am using VS.NET Arch. and I am having problems connecting to ANY database. I am trying to a either a SqlConnection or OleDBConnection object to my project. When I try to define the...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
5
by: Ike | last post by:
Through Java, I am attempting to connect to a MySQL 4.12 server on a remote computer. I can connect fine via php. I cann connect fine via Java, through a servlet, when the servlet is on the same...
6
by: antonyliu2002 | last post by:
I was able to view table content easily before, but after I reinstalled everything, I cannot find the option to view table content in MS SQL Server Express. I can define table with no problem. ...
1
by: rubeel | last post by:
I cannot seem to connect to this Instance locally which was i able to in the past. I can connect to the instance from out side. The instance is running and the DBs in the instance are available and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.