Trusted connection doesn't work with SQL server and ASP.Net

  • Thread starter Thread starter Peter Afonin
  • Start date Start date
P

Peter Afonin

Hello:

I need to execute a DTS package from an ASP.Net application. The SQL server
registration properties are set to "Use Windows authentication".
domain\ASPNET is among the SQL server users.

However, when I use this string to load DTS package:

oPkg.LoadFromSQLServer("WIN2000", , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, , , ,
"Import_Sales_History")

I get this error:

"System.Runtime.InteropServices.COMException (0x80004005): Login failed for
user '(null)'. Reason: Not associated with a trusted SQL Server connection.
at DTS._Package.LoadFromSQLServer(String ServerName, String
ServerUserName, String ServerPassword, DTSSQLServerStorageFlags Flags,
String PackagePassword, String PackageGuid, String PackageVersionGuid,
String PackageName, Object& pVarPersistStgOfHost)

If I specify UID and password:

oPkg.LoadFromSQLServer("WIN2000", "UID", "password",
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, , , ,
"Import_Sales_History")

everything works OK.

Why the trusted connection doesn't work in my case, despite that the SQL
server properties are set to use it?

I would appreciate your help.

Thank you,
 
Thank you.

Yes, I use domain\ASPNET account.

Peter

Kevin Spencer said:
Unless you've set up a Domain ASPNET account, it doesn't exist. The ASPNET
account is a machine-level account.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
The more I learn, the less I know.
 
Back
Top