|
-
Sep 1st, 2004, 04:15 AM
#1
Thread Starter
Frenzied Member
connection string
hi to everyone its me again..
[php]
questioning the endlesses questions...
i have a connection string in vb.net application and it works fine..
[/php]
but when i use this connection to asp.net it throws an error: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
VB Code:
Dim cn As New SqlConnection("integrated security=true;initial catalog=northwind;data source=local host")
what im i missing in asp.net???
im very new in this thing since this is my first approach on asp.net..
pls. help...
-
Sep 1st, 2004, 04:37 AM
#2
Extra! Extra! Get your connection strings here:
www.able-consulting.com/ado_conn.htm
-
Sep 1st, 2004, 03:08 PM
#3
PowerPoster
Extra! Extra!
Get your other connection strings here:
www.connectionstrings.com
-
Sep 1st, 2004, 04:25 PM
#4
Connection string aside, am I the only one who finds it odd that it said failed login (null) - which tells me there's no user context, and since he's using trusted security.... that's why it failed. There's no user context from which to connec to the database with.
TG
Last edited by techgnome; Sep 1st, 2004 at 04:58 PM.
-
Sep 1st, 2004, 04:31 PM
#5
Frenzied Member
Is the SQL Servers security setup to use Windows Authentication of SQL Server Authentication?
If SQL Server Authentication, then it would expect a username and password in the connectionstring.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Sep 1st, 2004, 05:01 PM
#6
Originally posted by Memnoch1207
Is the SQL Servers security setup to use Windows Authentication of SQL Server Authentication?
If SQL Server Authentication, then it would expect a username and password in the connectionstring.
That's true. The connection string does say "integrated security=true;" which tells me WinNTAuth is to be used, - but that doesn't mean the server is set up that way. I don't know under what context the page is running. Obviously, what ever user context (if any) the code is running under, that user doesn't have permissions. Since it reported the login as (null) I have to assume that it isn't running under any user context. In which case it needs to be converted over to use SQL authentication, in which case the connection string would need to be changed, or the code needs to be forced to run under a specific user context that has the appropriate security to access the database.
TG
-
Sep 1st, 2004, 07:59 PM
#7
Thread Starter
Frenzied Member
thanks guys for the reply..i tried what you have suggested if it works..
more power..
-
Sep 2nd, 2004, 09:46 PM
#8
PowerPoster
If you want to use windows authentication, you need to turn off anonymous access in IIS. If that is checked, windows credentials won't be passed on to ASP.NET.
-
Sep 2nd, 2004, 09:56 PM
#9
Thread Starter
Frenzied Member
thanks hellswraith for the reply..
actually i already solve this scenario..
i just add new login (computername\Aspnet) and it do the trick..
hey sorry for my stupidity im very new in this thing and i just want to know if asp.net allow global declarations..ie. i want ot declare my connection in global so that i can access it everywhere..
thanks in advance mate..
more power..
-
Sep 5th, 2004, 05:12 PM
#10
PowerPoster
Store your connection string in the web.config file. Add a section that looks like this (search on the web for more info):
<appSettings>
<add key="ConnectionString" value="your long connectionstring here" />
</appSettings>
Then, anywhere in your app, you can do a
MyString = System.Configuration.ConfigurationSettings.AppSettings("ConnectionString")
-
Jun 17th, 2005, 09:12 AM
#11
New Member
Re: connection string
Hello
I am having the same problem and I have read this thread over and over again and i just cant see how Iam supposed to resolve it. I might be being stupid but please have patience.
Thanks for you time
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|