|
-
Aug 10th, 2011, 02:16 AM
#1
Thread Starter
Junior Member
VS2010 ASP > SQL Connections
Hi,
I have an ASP.Net website running on IIS7.
The Application Pool is set to ASPv4 Classic.
Authentication Mode is set to ASP.Net Authentication & Windows Authentication
My question is, when I want to connect to SQL using a "trusted connection" in the Connection String, what user will actually be passed into SQL?
I thought it would pass my logon details, but it is coming back with an NT AUTHORITY\ANONYMOUS LOGON error, which seems to point towards it not passing in my logon.
Is this expected behaviour?
Last edited by davieeeee; Aug 10th, 2011 at 02:26 AM.
-
Aug 10th, 2011, 02:23 AM
#2
Re: VS2010 ASP > SQL Connections
Will the db has the all the user logins created in it ?
Did you add <identity impersonate="true" /> in the web.config
Last edited by danasegarane; Aug 10th, 2011 at 02:27 AM.
Please mark you thread resolved using the Thread Tools as shown
-
Aug 10th, 2011, 02:30 AM
#3
Thread Starter
Junior Member
Re: VS2010 ASP > SQL Connections
No it wont, which brings up a good point.
I assume that I should not worry about individual user level access to the database then and just create a single ASP logon in SQL?
-
Aug 10th, 2011, 03:15 AM
#4
Re: VS2010 ASP > SQL Connections
Yes Create single user login and password and then add this in the web.config file
Code:
<identity impersonate="true" userName="domain\user" password="password" />
Please mark you thread resolved using the Thread Tools as shown
-
Aug 10th, 2011, 06:17 PM
#5
Thread Starter
Junior Member
Re: VS2010 ASP > SQL Connections
By placing that in the web.config, will that still recognize the logged in user? (this is an intranet application)
I need the user to be recognized for authentication purposes (so I can control menu items etc) however access to SQL via a single logon is acceptable.
-
Aug 11th, 2011, 03:07 AM
#6
Re: VS2010 ASP > SQL Connections
Hello,
If you are not going to provide user level permissions at the database, then you are not going to be able to pass the credentials of the logged in user to the database, as they will not be able to access the database.
Gary
-
Aug 11th, 2011, 04:00 AM
#7
Re: VS2010 ASP > SQL Connections
 Originally Posted by davieeeee
By placing that in the web.config, will that still recognize the logged in user? (this is an intranet application)
I need the user to be recognized for authentication purposes (so I can control menu items etc) however access to SQL via a single logon is acceptable.
Yes that will consider as the logged in user. User.Identity.Name will give the user name and when connecting to user the system will try to connect using the impersonated user name and password..
Please mark you thread resolved using the Thread Tools as shown
-
Aug 11th, 2011, 08:00 AM
#8
Frenzied Member
Re: VS2010 ASP > SQL Connections
If you are using a single SQL login, why not just use:
Dim strConnectString = _
"Persist Security Info=False;server=MyServer;" & _
"database=MyDB;User ID=MySQLLogin;Password=MyPassword"
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Aug 11th, 2011, 11:13 AM
#9
Re: VS2010 ASP > SQL Connections
Assuming of course the above was in a web.config file, so that you didn't have to re-compile your application, just to change the database connection string 
Gary
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
|