Ask a Question related to ASP.NET General, Design and Development.
-
Christian #1
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
Christian Guest
-
Can't Connect to FTP, Need Help
For the past 2 years I have connected to our ftp site through Microsoft Frontpage. I just bought Macromedia Dreamweaver/Contribute as an upgrade,... -
i want to use connect old again.
i am doing chat application,when network failed it can not connect to FMS2, so i can not chat, but when network have got a gain, why I can not chat?... -
FCS connect
Hi Guys, I have a little issue with my connection. i am running my CCTV through my FlashComm Server and I have to start my broadcast manually.... -
Help Cant Connect?
I just simply want to connect to my webpage. I already have a website but then it asks me my network path? I dont even know what that is...I have... -
How to use “RDS.Connect” to connect to a MS Access database?
The example I am working from uses the following code which does not work: RDS.Connect = "Provider='sqloledb';Integrated Security='SSPI';Initial ... -
Ray Dixon [MVP] #2
Re: cannot connect to DB from ASP.Net app
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
[url]http://msdn.microsoft.com/netframework/downloads/samples/default.aspx?pull=/library/en-us/dnnetsec/html/secnetch12.asp[/url]
for more in-depth info about data access security.
--
Ray Dixon - Microsoft MVP
[email]ray@NOSPAM.greeble.com[/email]
(remove NOSPAM. from my e-mail address for a direct reply)
"Christian" <christian.cambier@pandora.be> wrote in message
news:pOUSa.24701$F92.2621@afrodite.telenet-ops.be...security=SSPI;> 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???> 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
>
>
Ray Dixon [MVP] Guest



Reply With Quote

